Menu
Coddy logo textTech

29. Longest Increasing Sub

Lesson 30 of 31 in Coddy's 30 Days of Logic Building in C++ course.

challenge icon

Challenge

Medium

Write a function to find the length of the longest increasing subsequence in an array.

Input: [10, 9, 2, 5, 3, 7, 101, 18]

Output: 4 (The longest increasing subsequence is [2, 3, 7, 101])

Try it yourself

#include <vector>
using namespace std;

int lengthOfLIS(vector<int> nums) {
    // Write code here
}

All lessons in 30 Days of Logic Building in C++