← 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
Hiring now
Swiggy has 155 open roles right now
landed applies to roles like these for you, on each company’s own site, with answers written for the role.
Get 5x interviews10 free auto-applies. No card.
Client Servicing Executive
Remote
Senior Executive - Content
Delhi, DL, India
Executive - Graphic Designer
Mumbai, MH, India
Next question