You are viewing a single comment's thread. Return to all comments →
My solution is exactly like this, but 2 cases are failing because of timeout. How did you resolve it?
Check your while should contain both conditions while (queue.size() > 1 && queue.peek() < K) because while (queue.peek() < K) won't suffice.
you might be lucky...my two test cases are also failing due to TLE.