Skip to content

Practice Non-decreasing Subsequences

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#491
LeetCode Problem

Non-decreasing Subsequences

Problem Statement

Given an integer array nums, return all the different possible non-decreasing subsequences of the given array with at least two elements. You may return the answer in any order.

Source: Non-decreasing Subsequences on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [4,6,7,7]
Output
[[4,6],[4,6,7],[4,6,7,7],[4,7],[4,7,7],[6,7],[6,7,7],[7,7]]

# Example 2

Input
nums = [4,4,3,2,1]
Output
[[4,4]]

Constraints

1 <= nums.length <= 15
-100 <= nums[i] <= 100

Related LeetCode Problems

Practice more problems similar to Non-decreasing Subsequences.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.