Find K-th Largest and Longest Vacation
Company: Meta
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: This pair of problems evaluates array manipulation and algorithmic problem-solving skills, specifically order-statistics for selecting the k-th largest element and maximizing consecutive sequences under constrained transformations for the vacation streak problem.
Zero-Indexed Kth Largest
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([5,-3,9,1], 0)
Expected Output: 9
Explanation: k=0 is largest.
Input: ([5,-3,9,1], 3)
Expected Output: -3
Explanation: k=3 is smallest in four elements.
Input: ([2,2,1], 1)
Expected Output: 2
Explanation: Duplicates count as separate positions.
Hints
- Clarify edge cases before coding.
- Keep the return value deterministic.
Longest Vacation With PTO
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ('WHHWWHW', 2)
Expected Output: 5
Explanation: Use PTO to create a length-5 vacation block.
Input: ('WWW', 1)
Expected Output: 1
Explanation: Only one workday can be covered.
Input: ('HHH', 0)
Expected Output: 3
Explanation: Existing holidays form the full streak.
Hints
- Clarify edge cases before coding.
- Keep the return value deterministic.