![]() |
VOOZH | about |
draw(r, c): Draw a shape (represented by an alphabet from 'A' to 'Z') on cell (r, c). If multiple shapes are drawn on a cell, the most recent shape is displayed.delete(r, c): Delete the most recent shape from cell (r, c). If multiple shapes are present, the most recent shape is removed, revealing the next most recent. If no shapes exist, 0 is displayed.move(r1, c1, r2, c2): Move the shape from cell (r1, c1) to (r2, c2), following the same rules for multiple shapes. The question was initially vague, and I had to ask several follow-up questions to clarify the requirements. My first solution processed each operation in O(N) time. However, when asked to optimize it, I proposed a solution using a hashmap and queue that achieved O(logN) time per operation, which satisfied the interviewer.Results were announced on the same day, with three students receiving offers.