← All questions
Coding
Array
Asked at
J.P. Morgan
Microsoft
Swiggy
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
- 01Ask for the exact array task and constraints.
- 02Determine whether order may change and whether mutation is allowed.
- 03Choose scan, hash map, sorting, prefix, or two-pointer technique.
- 04State the loop invariant before coding.
- 05Test empty, singleton, duplicate, and boundary values.
Reference answer
Then expect these follow-ups
What information determines whether sorting is allowed?
Tests: follow-up reasoning
Which invariant would you state for an in-place filter?
Tests: constraint adaptation
Free to read · better with Enzo
Practice this out loud with Enzo
Enzo runs it as a mock interview, pushes back with follow-ups, and grades you on the rubric.
Next question