← All questions
MediumCoding
Find the Maximum Length of Valid Subsequence II
Asked at
Expedia
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+
- 01State the pairwise validity condition precisely.
- 02Bound values by their remainders modulo k.
- 03Define DP by ending remainder and required pair residue.
- 04Extend only states compatible with the new value.
- 05Take the maximum over all states.
Reference answer
Then expect these follow-ups
Why is the previous remainder determined by p and r?
Tests: correctness reasoning
Can this state be compressed further?
Tests: follow-up reasoning
Hiring now
Expedia has 109 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.
Software Development Engineer III - Platform Productivity Tools
India - Gurgaon
Sr Manager, Software Engineering
Austin Domain 11 - HomeAway
Software Development Engineer II
India - Gurgaon
Next question