22. First Non-Repeating Character
EasyHashing
Return the index of the first character in s that appears only once, or -1 if there is none.
Example 1
Input: s = "interview" Output: 1 Explanation: "n"
Constraints
1 ≤ s.length ≤ 10⁵
EasyHashing
Return the index of the first character in s that appears only once, or -1 if there is none.
Input: s = "interview" Output: 1 Explanation: "n"
1 ≤ s.length ≤ 10⁵Tab indents · Ctrl/⌘ + Enter runs · Esc then Tab leaves the editor
Run checks these cases; the expected output comes from the reference solution. Submit judges all 4 hidden and sample tests.
Code runs only in your browser in an isolated sandbox. Progress and submissions are saved on this device.