PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Pinduoduo

Compute longest increasing subsequence length

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of sequence analysis and algorithmic problem solving, assessing competency with subsequences, reasoning about complexity, and algorithmic optimization.

  • medium
  • Pinduoduo
  • Coding & Algorithms
  • Software Engineer

Compute longest increasing subsequence length

Company: Pinduoduo

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

## Coding Question You are given an integer array `nums`. Return the **length** of the **longest strictly increasing subsequence** (not necessarily contiguous). A subsequence is obtained by deleting zero or more elements without changing the order of the remaining elements. ### Examples - Input: `nums = [10,9,2,5,3,7,101,18]` → Output: `4` (one LIS is `[2,3,7,101]`) - Input: `nums = [0,1,0,3,2,3]` → Output: `4` - Input: `nums = [7,7,7,7]` → Output: `1` ### Constraints - `1 <= nums.length <= 2 * 10^5` - `-10^9 <= nums[i] <= 10^9` ### Notes A straightforward dynamic programming solution is `O(n^2)`. Can you derive an optimized approach (commonly described as greedy with binary search) that runs in about `O(n log n)`?

Quick Answer: This question evaluates understanding of sequence analysis and algorithmic problem solving, assessing competency with subsequences, reasoning about complexity, and algorithmic optimization.

Related Interview Questions

  • Find Shortest Square-Sum Path - Pinduoduo (hard)
  • Compute User Login Streaks - Pinduoduo (easy)
  • Determine Straight Flush - Pinduoduo (easy)
  • Design a Recency-Eviction Cache - Pinduoduo (medium)
  • Find missing rank in a straight - Pinduoduo (easy)
Pinduoduo logo
Pinduoduo
Jan 1, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
2
0
Loading...

Coding Question

You are given an integer array nums.

Return the length of the longest strictly increasing subsequence (not necessarily contiguous).

A subsequence is obtained by deleting zero or more elements without changing the order of the remaining elements.

Examples

  • Input: nums = [10,9,2,5,3,7,101,18] → Output: 4 (one LIS is [2,3,7,101] )
  • Input: nums = [0,1,0,3,2,3] → Output: 4
  • Input: nums = [7,7,7,7] → Output: 1

Constraints

  • 1 <= nums.length <= 2 * 10^5
  • -10^9 <= nums[i] <= 10^9

Notes

A straightforward dynamic programming solution is O(n^2). Can you derive an optimized approach (commonly described as greedy with binary search) that runs in about O(n log n)?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Pinduoduo•More Software Engineer•Pinduoduo Software Engineer•Pinduoduo Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.