LeetCode — Longest Increasing Subsequence (Blind Curated 18)

Given an integer array nums, return the length of the longest strictly increasing

subsequence

.

Example 1:

Example 2:

Example 3:

Constraints:

  • 1 <= nums.length <= 2500
  • -104 <= nums[i] <= 104

Follow up: Can you come up with an algorithm that runs in O(n log(n)) time complexity?

Solution:

Time complexity: O(Nlog^N)

Space complexity: O(N)

LC — Longest Increasing Subsequence (Blind Curated 18)

--

--

👨‍💻

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store