mediumArrays
Identify Unique Identifier Solution
Problem Statement
You are given an array of integers `ids` containing unique and duplicate identifiers. Write a function to determine whether a given identifier `target_id` is new or exists in the array.
Examples
Example 1:
Input:{"ids":[1,2,3,4,5],"target_id":6}
Output:true
Example 2:
Input:{"ids":[1,2,3,4,5],"target_id":3}
Output:false
Time: O(N) Space: O(1)
Analyze constraints and compute optimal solutions step-by-step.
Run, Test & Submit Code
Ready to practice this challenge? Launch our interactive compilation environment with compiler validation.
Solve on Interactive WorkspaceTested Solutions
No solution code is currently loaded.
Complete this code in the workspace editor.
