Every API request your front end sends carries an id that is supposed to be unique. A bug report says some ids were reused.
Write hasDuplicateIds(ids) that returns true if any id appears more than once in ids, and false otherwise.
Input: ids = ["r1","r2","r3","r2"] Output: true
r2 appears twice.
Input: ids = ["a","b","c"] Output: false
Every id is different.
0 <= ids.length <= 10^5Run 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 #21 Duplicate Request IDs. 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.