Tap here to switch tabs
Problem
Submissions

Problem: Find the Most Competitive Subsequence

med
30 min
Try to solve the Find the Most Competitive Subsequence problem.

Statement

Given an integer array nums and an integer k, return the most competitive subsequence of nums of size k.

A subsequence a of length k is considered more competitive than another subsequence b of length k if, at the first position where a and b differ, the value in a is strictly smaller than the value in b.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq k ≤\leq nums.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Most Competitive Subsequence

med
30 min
Try to solve the Find the Most Competitive Subsequence problem.

Statement

Given an integer array nums and an integer k, return the most competitive subsequence of nums of size k.

A subsequence a of length k is considered more competitive than another subsequence b of length k if, at the first position where a and b differ, the value in a is strictly smaller than the value in b.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq k ≤\leq nums.length