PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/TikTok

Compute longest increasing subsequence

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of sequence algorithms, dynamic programming concepts, and algorithmic optimization for the longest increasing subsequence problem, including subsequence reconstruction and complexity analysis.

  • Medium
  • TikTok
  • Coding & Algorithms
  • Machine Learning Engineer

Compute longest increasing subsequence

Company: TikTok

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Given an integer array nums, compute the length of a longest strictly increasing subsequence and also output one valid subsequence. Aim for an O(n log n) approach; explain the binary-search (patience sorting) technique, how to reconstruct the subsequence, and analyze time/space complexity. Follow-ups: adapt to non-decreasing subsequences, handle duplicates carefully, and discuss how to count how many LIS exist.

Quick Answer: This question evaluates understanding of sequence algorithms, dynamic programming concepts, and algorithmic optimization for the longest increasing subsequence problem, including subsequence reconstruction and complexity analysis.

Related Interview Questions

  • Parse a nested list from a string - TikTok (medium)
  • Implement stacks, streaming median, and upward path sum - TikTok (easy)
  • Maximize sum with no adjacent elements - TikTok (medium)
  • Implement stack variants and path-sum check - TikTok (medium)
  • Find the longest palindromic substring - TikTok (easy)
TikTok logo
TikTok
Sep 6, 2025, 12:00 AM
Machine Learning Engineer
Onsite
Coding & Algorithms
2
0

Given an integer array nums, compute the length of a longest strictly increasing subsequence and also output one valid subsequence. Aim for an O(n log n) approach; explain the binary-search (patience sorting) technique, how to reconstruct the subsequence, and analyze time/space complexity. Follow-ups: adapt to non-decreasing subsequences, handle duplicates carefully, and discuss how to count how many LIS exist.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More TikTok•More Machine Learning Engineer•TikTok Machine Learning Engineer•TikTok Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ 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.