Unequal Elements (Also for Core/Database Intern :)
Problem Overview
- Find the maximum length of a subsequence of skill types where the number of adjacent unequal pairs is at most k.
- Input: skills array of size n and integer k; Output: maximum m satisfying the adjacent inequality limit.
- Context: building a HackerRank test that groups similar skills together for assessment.
- Constraints: 1 ≤ n ≤ 2e3, 1 ≤ k < n, 1 ≤ skills[i] ≤ 2e3.
- Asked in Snowflake interviews; a coding interview problem and common interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
