Round 1
Questions:
Question 1
Determine if there’s an interval that sums to the target
Input:
- [1, (3, 1, 4), 23], target: 8
- [1, 3, 1, 4, 23], target: 7
Output: - True (because 3 + 1 + 4 = 8)
- False
Note: All integers are positive.
Question 2
Find non-overlapping 3 intervals of length k to maximize the sum of their elements.
Input:
- ar = [1, (5, 8), 3, 4, (7, 5), 2, (5, 9)], k=2
Output: - 39 (because (5+8)+(7+5)+(5+9) = 39)
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.