Find the longest palindrome in a string.
Anonymous
I initially said start at the front and move through the string while noting the longest palindrome. He asked about the time complexity and I started muttering through a thought process. Initially guessed O(N), then wrote out n(n+1)/2 and suggested N^2 and he agreed. He started talking about optimizing (unclear) so I switched to an approach with a pointer in front and a pointer in back, which he seemed more enthusiastic about - after I wrote out pseudocode for THAT he said it was N^3, and I was extremely confused. He started talking about optimization again. I attempted to articulate my confusion regarding how this solution was worse, and he said "this is not solution, this is step 2." He then literally asked me if I knew "what time complexity is in computer science"..... I'm a third year CS student.
Check out your Company Bowl for anonymous work chats.