File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
algorithms/greedy/minimum_number_of_pushes Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 33
44
55def minimum_pushes_greedy_with_sorting (word : str ) -> int :
6- # frequency vector of size 26 that storees the count of each letter in the word
6+ # frequency vector of size 26 that stores the count of each letter in the word
77 # Space complexity here is O(1) because we have a constant space for the given list, i.e. 26
88 frequency = [0 ] * 26
99
10- # Iterate throuch each character and increment the count in the frequency at the index corresponding to char - "a"
10+ # Iterate through each character and increment the count in the frequency at the index corresponding to char - "a"
1111 # since we know from the given constraints that we will have lowercase English letters, this will work fine
1212 # This is an O(n) operation, as each character in the word is iterated through
1313 for char in word :
You can’t perform that action at this time.
0 commit comments