2dbi

Solve a non-standard variant of LIS

via2dbi

Problem

A non-standard variant of Longest Increasing Subsequence (LIS).

Approach

  • Start from the classic O(n log n) patience-sorting / binary-search LIS
  • Adapt the DP recurrence to the variant's twist (e.g., constraints on adjacency, differences, or grouping)
  • Discuss the DP state and how the variation changes the transitions

Note

The exact twist is non-standard — clarify the variant's rules with the interviewer before coding.

Add a follow-up question they asked
Adapt the O(n log n) method
Reconstruct the subsequence
asked …
LeaderboardSalary
Language
Account