491. Increasing Subsequences Medium

@problem@discussion
#Array#Hash Table#Backtracking#Bit Manipulation



1/**
2 * [491] Increasing Subsequences
3 *
4 * Given an integer array nums, return all the different possible increasing subsequences of the given array with at least two elements. You may return the answer in any order.
5 * The given array may contain duplicates, and two equal integers should also be considered a special case of increasing sequence.
6 *  
7 * Example 1:
8 * 
9 * Input: nums = [4,6,7,7]
10 * Output: [[4,6],[4,6,7],[4,6,7,7],[4,7],[4,7,7],[6,7],[6,7,7],[7,7]]
11 * 
12 * Example 2:
13 * 
14 * Input: nums = [4,4,3,2,1]
15 * Output: [[4,4]]
16 * 
17 *  
18 * Constraints:
19 * 
20 * 	1 <= nums.length <= 15
21 * 	-100 <= nums[i] <= 100
22 * 
23 */
24pub struct Solution {}
25
26// problem: https://leetcode.com/problems/increasing-subsequences/
27// discuss: https://leetcode.com/problems/increasing-subsequences/discuss/?currentPage=1&orderBy=most_votes&query=
28
29// submission codes start here
30
31impl Solution {
32    pub fn find_subsequences(nums: Vec<i32>) -> Vec<Vec<i32>> {
33        vec![]
34    }
35}
36
37// submission codes end
38
39#[cfg(test)]
40mod tests {
41    use super::*;
42
43    #[test]
44    fn test_491() {
45    }
46}
47


Back
© 2025 bowen.ge All Rights Reserved.