Round 1
Questions:
Test Duration: 85 Minutes
No Negative Marking
Sections:
Aptitude A:
Questions: 9
Time: 20 Minutes
Aptitude B:
Questions: 6
Time: 15 Minutes
Coding:
Questions: 3
Time: 50 Minutes
Difficulty: 1 Easy, 2 Medium
Problem 1: Arrays - Parity Alternating Subsequence
Objective:
Given an array A of N elements, find the maximum sum of a parity-alternating subsequence (odd-even or even-odd pattern) with the maximum possible length.
Constraints:
1 < N < 100
0 ≤ A[i] ≤ 100,000
Example:
Input:
A = [1, 2, 3, 4, 5]
Output:
9 (Subsequence: [1, 2, 3, 4])
Problem 2: Closest Meeting Point
Objective:
Sam and Tom are positioned at A and B on the X-axis. Sam moves C steps left or 1 step right or stays on the same position per second, and Tom moves D steps right or 1 step left or stays on the same position per second. Find the minimum time for them to meet.
Constraints:
0 < A, B, C, D < 1000
Example:
Input:
A = 5, B = 1, C = 2, D = 1
Output:
2
Problem 3: Count Odd Left & Even Right
Objective:
For a given array, find the number of odd values to the left and even values to the right of a specific element.
Constraints:
1 ≤ N ≤ 1000
-1000 ≤ A[i] ≤ 1000
Example:
Input:
A = [6, 4, 3, 5, 2, 1]
Output:
1 2 (Odd to the left of 3: 1, Even to the right of 3: 2)
Candidate's Approach
-
Problem 1:
- Traverse through the array while keeping track of the last chosen number’s parity.
- Alternate between odd and even values to maximize the subsequence length.
- Keep track of the sum for the optimal subsequence.
-
Problem 2:
- Use a BFS or DP approach to simulate their movements, minimizing the difference in their positions.
- At each second, update positions based on possible moves (left, right, stay).
-
Problem 3:
- Iterate through the array to count odd values to the left and even values to the right of the specified element.
Interviewer's Feedback
No feedback provided.