← All questions
HardCoding
First Missing Positive
Asked at
FactSet Research Systems Inc.
ServiceNow
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+
- 01Use one through n as relevant values.
- 02Place each valid value in its home index.
- 03Guard swaps against duplicates.
- 04Scan for the first missing home value.
- 05Return n plus one when all homes are filled.
Reference answer
Then expect these follow-ups
Why do values larger than n not matter?
Tests: correctness reasoning
How would you preserve the original array?
Tests: follow-up reasoning
Hiring now
ServiceNow has 794 open roles right now
Also hiring: FactSet Research Systems Inc.
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.
Customer Success Executive
Remote
CRM Senior Solution Sales Executive
Brasilia, Brasilia, Brazil
CPQ Senior Solution Sales Executive
Sao Paulo, SAO PAULO, Brazil
Next question