Longest Increasing Subsequence

Medium

Longest Increasing Subsequence

Problem Statement

Given an integer array

nums
, the task is to find the length of the longest increasing subsequence (LIS). A subsequence is an arrangement of elements from the original array, where each element appears only once.

The goal is to return the length of the longest increasing subsequence that can be formed from the elements in

nums
.

Rules and Constraints

  • The input array
    nums
    will consist of distinct integers.
  • The array will have a length between 2 and 2 * 10^5 (inclusive).
  • The value range of the integers will be between -10^6 and 10^6 (inclusive).
  • The task should be completed in O(n * log(n)) time complexity, where n is the length of the input array.
  • The task should be completed within a space complexity of O(n), excluding the space used for the input array.

Note that this problem definition provides a clear and concise statement of the task, along with the necessary constraints and rules. It allows for a well-defined approach to developing a solution without introducing unnecessary ambiguity.

Example

Input: {"input_data":[1,2,3]} Output: [1,2,3]

CompaniesGoogleMetaAmazon
JavaScript

Login to write code

Solve problems, verify your skills, and earn XP.