Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Implement an efficient O(n log n) solution to find the longest increasing subsequence in an array.

Hard

Problem Statement

Implement an efficient O(n log n) solution to find the longest increasing subsequence in an array.

Sample Input

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

Sample Output

4

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
package main import "fmt" func longestIncreasingSubsequence(arr []int) int { // Your code here } func main() { arr := []int{10, 9, 2, 5, 3, 7, 101, 18} fmt.Println(longestIncreasingSubsequence(arr)) // Expected Output: 4 }
Log in or sign up to run or submit your code.Log inSign up
Input
[10, 9, 2, 5, 3, 7, 101, 18]
Expected Output
4