Not sure if this is O(n)

Instead of comparing the letter to each letters in the table like the one suggested in the video, why not store each letters into an array that correspond to the word length. For example for the word “boom” we store it to an array length of 4 then storing each letter into the array while comparing if there is a duplicate, once it founds a duplicate the loop ends. Would this use less iteration than comparing a letter to all the alphabetical letters in a table/array?

I hope you get my point, not a native English speaker.

Hi @h4vokh what you are talking about is the same thing using strings. In an array you declare the array and input all the values and we can call and individual array value by using array[]. look familiar to string[]? because it is the same thing with the only difference is that a string is only storing char instead of other values like an int or double.

The question Ben is posing in the video is not how we go about finding duplicates but rather what is the best way to go about it without taxing the PC each time. We want the player to spend more time playing and less time waiting for the game to validate each guess. Hope this helps.

I know this is more than a month old post but figured I’d chime in anyways. Have a great day.

Privacy & Terms