Longest Increasing Subsequence

Last updated: June 17, 2026

Quick Overview

Find the length of the longest strictly increasing subsequence. Explore O(n^2) DP and O(n log n) binary search approaches. A common Google DP question.

Google
Coding & Algorithms
Software Engineer
Google
June 17, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

197

0

397 solved


Find the length of the longest strictly increasing subsequence. Explore O(n^2) DP and O(n log n) binary search approaches. A common Google DP question.

How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Problem Analysis

The Longest Increasing Subsequence (LIS) problem can be approached using the dynamic programming (DP) technique due to its optimal substructure property. The key observation is that for any element in...

Approach

We will implement two solutions:

  1. O(n^2) DP Approach:
    • Create a DP array where dp[i] represents the length of the longest increasing subsequence that ends with the element at index i. ...

Submit Your Answer
Markdown supported

Related Questions