I was given an initial document and a sequence of key presses. The cursor starts at the very beginning of the document (position 0). The key presses are: typing text at the cursor, backspace to delete the character before the cursor, and moving the cursor right by one.
You have to turn these key presses into as few OT operations as possible: insert to insert text, delete to delete the character at the current position, and skip to skip over characters to the right. Only the final effective changes should be kept, e.g. text that was typed and then deleted should not show up in the result.
I passed all the test cases, but when I reviewed it afterwards I realized I had misunderstood the problem, and my approach doesn't generalize.
As a CS undergrad new grad, this was my only technical interview, and I got rejected right there. It feels like this company rarely picks up resumes for an interview in the first place, which really hurts 😭
Besides grinding LeetCode, how else can I prepare for original problems like this?
Discussion
Loading comments…