1181. Longest Increasing Subsequence — O(n log n)

MediumDynamic ProgrammingLIS Family

Given an array nums, return the length of the longest strictly increasing subsequence, using an O(n log n) approach. The input is JSON {nums}.

Input: JSON {nums}.

Output: Integer — the length of the longest increasing subsequence.

Examples

Example 1
Input: {"nums":[10,9,2,5,3,7,101,18]}
Output: 4
Explanation: [2,3,7,18].
Example 2
Input: {"nums":[0]}
Output: 1
Explanation: Single element.
Example 3
Input: {"nums":[7,7,7]}
Output: 1
Explanation: No strict increase.

Constraints

Asked by

AmazonMicrosoftGoogleAdobeFlipkart
Solve this problem in the editor →