Skip to main content
PreparationZone Logo
PreparationZone
Back to Coding

Coding · Medium · Pro

Length of longest increasing subsequence

CodingDynamic ProgrammingSenior
Model answerPreview

Approach

  • Patience sorting / tails array: for each num, binary search position to replace.
  • Length of tails is LIS length.

Java Solution

Java
public int lengthOfLIS(int[] nums) {
    int[] tai…