What a tricky problem!

  • 10

    Anyone think this problem should be hard? To me it is really unnatural to get the word count first and every time when seeing the new character go backward of current solution to check if they could be at later. Sure, given algorithm, I could understand it and see why it works, but I doubt I could come up such a solution in an interview. Anyone with me? Or how people could think of this direction without any hints?

  • 0

    I agree, this is indeed a tricky problem.

  • 0

    Thanks for your feedback, I agree it is a tricky question. I have just changed the difficulty to hard.

  • 1

    This is why we need to pray we won't have a brand new problem in our interview.

  • 0

    @aack I agree that it is hard to find a solution for this interview question. I understood some greedy approach from discussion, but it's hard for me to propose. The only possibility, in my opinion, is that when you saw the question, your brain chose the right angle immediately.

    This reflects one embarrassment of summarizing known techniques: there is always a new problem that can't be solved by them.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.