FastPrepDecreasing Subsequences
Problems/Decreasing Subsequences

Decreasing Subsequences

Google logoGoogle● MediumINTERNNEW GRADOA

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Special thanks: 🌷 A special thank you to our lovely, amazing frenz for sharing interview-preparation insights, including the reported date September 13, 2026! (∩˃o˂∩)♡ 💚

Given an int array nums of length n. Split it into strictly decreasing subsequences. Output the min number of subsequences you can get by splitting.

Function

minSubsequences(nums: int[]) → int

Examples

Example 1

nums = [5, 2, 4, 3, 1, 6]return = 3

You can split this array into: [5, 2, 1], [4, 3], [6]. And there are 3 subsequences you get. Or you can split it into [5, 4, 3], [2, 1], [6]. Also 3 subsequences. But [5, 4, 3, 2, 1], [6] is not legal because [5, 4, 3, 2, 1] is not a subsequence of the original array.

Example 2

nums = [2, 9, 12, 13, 4, 7, 6, 5, 10]return = 4

You can split the array into: [2], [9, 4], [12, 10], [13, 7, 6, 5].

Example 3

nums = [1, 1, 1]return = 3

Because of the strictly descending order you have to split it into 3 subsequences: [1], [1], [1].

Constraints

  • 1 ≤ nums.length ≤ 2 * 10^5
  • -10^9 ≤ nums[i] ≤ 10^9
  • Every input element must appear in exactly one output subsequence, and each subsequence preserves input order.

More Google Online Assessment questions

  • Minimum Cars for Rental RequestsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Minimum Operations to Make a SubsequenceOA · Seen Nov 2026
  • Book Reading EveningsOA · Seen Nov 2026
  • Count Score CategoriesOA · Seen Nov 2026
  • Shortest Path in a Binary MatrixOA · Seen Nov 2026
  • Robot Assembly Line ConflictsOA · Seen Oct 2026
  • Assign LockerOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Biggest Number From DigitsOA · Seen Oct 2026
  • Consolidate On-Call RotationsOA · PHONE SCREEN · Seen Oct 2026
  • Minimize Absolute Difference of Server LoadsOA · Seen Sep 2026

Similar questions at other companies

  • Task SchedulerAmazon · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Minimum Cost to Merge Values into OnePayPal · OAPayPal interview questions
  • Maximum K-Star SumC3.ai · OAC3.ai interview questions
  • Maximum Sum of a K-StarMicrosoft · OAMicrosoft interview questions
  • Maximum ScoreNVIDIA · OANVIDIA interview questions
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Task SchedulingJP Morgan Chase · OAJP Morgan Chase interview questions
  • Get Maximum AmountIBM · OAIBM interview questions
  • Optimize TikTok Reels ViewingTikTok · OATikTok interview questions
  • Rearrange Songs by AuthorZomato / Eternal · OAZomato / Eternal interview questions

Interview reports that mention this question

  • Google OA: What It Tests (2026)

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public int minSubsequences(int[] nums) {
        // write your code here
    }

}
Checking account…