Conversation
CheezItMan
left a comment
There was a problem hiding this comment.
You have the 1st method remove_duplicates working, but the minimum prefix isn't working. Also see my notes on your time complexity.
For minimum prefix you need to check to see if a letter matches each string, then if so, add it to prefix, The first letter that doesn't match every other string, you can exit and return prefix.
Let me know what questions you have.
| i = 0 | ||
| while i <= list.length | ||
| if list[i] == list[i + 1] | ||
| list.delete_at(i) |
There was a problem hiding this comment.
Since delete_at shifts all the subsequent elements 1 index to the left, it's an O(n) method. Since you have it in a loop that goes n times this method is O(n2)
| return strings[0] | ||
| end | ||
|
|
||
| total_words.times do |index| |
There was a problem hiding this comment.
shouldn't one of these loops go the number of characters in a string, rather than the number of strings times?
You also have an issue with the if statement, you're comparing the wrong things.
No description provided.