Colorful Increasing Subsequences
Updated
Problem statement
Each candle has a height and one of k colors. Count subsequences whose heights are strictly increasing and that contain every color at least once. Return the result modulo 10^9 + 7.
Function
countColorfulSubsequences(heights: int[], colors: int[], k: int) → intExamples
Example 1
heights = [1,3,2,4]colors = [1,2,2,3]k = 3return = 2The two valid subsequences choose height 1, either height 2 or 3, and height 4.
Constraints
2 <= heights.length = colors.length <= 1001 <= k <= 71 <= colors[i] <= k1 <= heights[i] <= 10^9
More Atlassian Online Assessment questions
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024
- Binary Search Tree IteratorOA · Seen Nov 2023
- Binary Tree Level Order TraversalOA · Seen Nov 2023
Similar questions at other companies
- Delete K Subsets for Maximum ScoreRubrik · OARubrik interview questions
- Optimize Discount Selection Under a Point BudgetPalantir · OAPalantir interview questions
- Maximum Index-Weighted Sum with Disjoint SwapsVisa · OAVisa interview questions
- Submask Sum QueriesIntuit · OAIntuit interview questions
- Distinct Bitwise-OR Scores of Increasing SubsequencesWalmart · OAWalmart interview questions
- Match an XOR-Adjusted SumSquarepoint Capital · OASquarepoint Capital interview questions
- Madam C.J. Walker's Business PlanFortinet · OAFortinet interview questions
- Count Divisible PermutationsDeloitte · OADeloitte interview questions
- Get Distinct Goodness ValuesCitadel · OACitadel interview questions
- Max ProfitIBM · OAIBM interview questions