vendredi 27 décembre 2019

How to hash a word using Hashing technique in python using list / dictionary(as c++ )?

I want to hash a word in python to count each letter occurence.

c++ code:

     int *arr = new int[256]();
    for(int i=0;i<s.size();i++){
         arr[s[i]]++;
        }

I want to implement the same in python using dictionary or list.

Aucun commentaire:

Enregistrer un commentaire