A network log records request IDs. Every request appears twice, once when it starts and once when it finishes, except one request that never finished.
Write unfinishedRequest(ids) that returns that ID. Use O(1) extra memory.
Input: ids = [7,3,5,3,5] Output: 7
3 and 5 appear twice. 7 appears once.
Input: ids = [7] Output: 7
The only request never finished.
1 <= ids.length <= 3 × 10^4, and the length is odd-2^31 <= ids[i] <= 2^31 - 1Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #671 Find the Unpaired Request. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.