Interview Experience | Allen Digital | Senior Software Engineer | 15 Sep 2024 | Bangalore | REJECTED
Round 1: Bar Raiser Round (Machine Coding)
Questions: A limited-time deal implies that a seller will put up an item on sale for a limited time period, say, 2 hours, and will keep a maximum limit on the number of items that would be sold as part of that deal. Users cannot buy the deal if the deal time is over. Users cannot buy if the maximum allowed deal has already been bought by other users. One user cannot buy more than one item as part of the deal. There are multiple ways by which a deal can be claimed. Use appropriate design patterns to switch to a certain way of claiming a deal at runtime.
The task is to create APIs to enable the following operations (Do not create API, just create method and take appropriate request and response params):
- Create a deal with the price and number of items to be sold as part of the deal - Required
- End a deal
- Update a deal to increase the number of items or end time
- Claim a deal - Required
Expectations:
- Code should be modular and working
- IMP Code should follow Open Closed Principle
- IMP Use design patterns whenever required
- IMP Use local storage (in-memory data structures) instead of database
- Throw appropriate exceptions whenever necessary
- Use appropriate variable naming
- Classes and their relationships should be proper while doing entity modeling
- Separation of concerns should be used whenever required
- Test classes - IMP (at least driver code is needed)
- Use concurrency wherever required - IMP
Candidate's Approach
The candidate felt confident about clearing this round as it was interactive. They focused on modular code and adhered to the Open Closed Principle while implementing the required methods.
Interviewer's Feedback
The candidate cleared this round.
Round 2: PS/DS Behavioral Round
Questions:
-
Search in sorted rotated array: Given a sorted and rotated array arr[] of n distinct elements, the task is to find the index of the given target element in the array. If the target is not present in the array, return -1.
- Example:
Input : arr[] = {4, 5, 6, 7, 0, 1, 2}, target = 0 Output : 4 Input : arr[] = { 4, 5, 6, 7, 0, 1, 2 }, target = 3 Output : -1 Input : arr[] = {30, 40, 50, 10, 20}, target = 10 Output : 3
- Example:
-
Minimum number of platforms required: We are given two arrays that represent the arrival and departure times of trains, the task is to find the minimum number of platforms required so that no train waits.
- Example:
Input: arr[] = {9:00, 9:40, 9:50, 11:00, 15:00, 18:00}, dep[] = {9:10, 12:00, 11:20, 11:30, 19:00, 20:00} Output: 3 Explanation: There are at-most three trains at a time (time between 9:40 to 12:00) Input: arr[] = {9:00, 9:40}, dep[] = {9:10, 12:00} Output: 1 Explanation: Only one platform is needed.
- Example:
Candidate's Approach
(i) The candidate provided an optimized solution to the first problem using Binary Search (O(log N)). (ii) For the second problem, due to time constraints, they solved it with a time complexity of O(n*p) and space complexity of O(t), where t is the minimum number of platforms.
Interviewer's Feedback
No feedback provided.