Jewels and Stones
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You have a string jewels where every character names a type of stone that counts as a jewel, and a string stones where each character is one stone you own.
Return how many of your stones are jewels. Letters are case-sensitive: "a" and "A" are different stone types.
All characters in jewels are distinct. Aim for O(len(jewels) + len(stones)) time.
Examples
Constraints
- 1 <= jewels.length, stones.length <= 50
- `jewels` and `stones` contain only English letters
- All characters of `jewels` are unique
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.