Round 1: Design Round
Questions:
Design a payment transition journey for a user.
Design and implement a user journey service for monitoring users as they navigate through various use cases. This will be a rule-based journey framework where a user will onboard a journey and move along various stages on the basis of specific conditions.
Requirements:
- Journey is a Directed Acyclic Graph (DAG) that represents a predefined path to track a user on.
- A journey consists of 'n' stages, and users must complete specific actions/events to advance to the next stage.
- Multiple users can onboard to the same journey.
- A user can onboard a journey only once.
- There will be complete isolation across different journeys.
- Journeys can be of 2 types: time-bound (having a start-date, end-date) and perpetual (no validity).
- The first stage in the journey will be the onboarding stage, middle stages will be the onward stages, and the final stage will be the terminal stage.
- The journey should be marked as active for it to be picked as part of the evaluation.
Example:
- J1: Stage 1 -> Stage 2 -> Stage 3. Onboarding step for Stage 1 is login. For stage 2 is user opening recharge page and Stage 3 is user doing a recharge transaction.
- J2: Stage 1 -> Stage 2. Onboarding step is the user opening a UPI lite account. For stage 2 is the user doing a top-up on their UPI lite account.
Mandatory Implementations:
createJourney(Journey journey)
updateState(String JourneyId, boolean active)
getJourney(String journeyId)
evaluate(String userId, Payload payload)
getCurrentStage(String userId, String journeyId)
isOnboarded(String userId, String journeyId)
Optional:
- Provide a way to send SMS to a user as soon as any stage transition happens.
- Add support for recurring journeys.
Why the journey service? This service serves as a platform for creating multiple journeys for different user paths and tracking users along the journey.
Points to note:
- Your code should cover all the mandatory functionalities explained above.
- Your code should be executable and clean.
- All necessary validations must be present.
- In case of an exception, proper errorCode must be present.
- Store the data in-memory for journeys and the user-transitions within the journey.
Result: CLEARED
Candidate's Approach
The candidate designed a service that tracks user journeys using a Directed Acyclic Graph (DAG) structure. They implemented the mandatory functions to create, update, and evaluate journeys, ensuring that the service could handle multiple users and maintain isolation between journeys. The candidate also focused on ensuring the code was clean and executable, with proper validations and error handling.
Interviewer's Feedback
The interviewer appreciated the candidate's understanding of the requirements and their ability to implement the necessary functionalities effectively. They noted the clarity of the design and the candidate's attention to detail in handling edge cases.
Round 2: High Level System Design
Questions: Design a flight aggregator service with the following features:
- Need to provide search of flight.
- Need to optimize flight searching and rescheduling.
- Need to tell tech stack and code flow.
Result: CLEARED
Candidate's Approach
The candidate proposed a high-level architecture for the flight aggregator service, detailing how to implement the search and optimization features. They discussed the tech stack that would be suitable for the service and outlined the code flow for handling flight searches and rescheduling.
Interviewer's Feedback
The interviewer found the candidate's design to be well thought out and comprehensive. They appreciated the candidate's ability to articulate the tech stack and code flow clearly.
Round 3: Problem Solving
Questions:
-
- Output: need to return the next element 5 plus the parentNode.
- Trick: do not give O(n) solution, want log(n) solution.
- Result: Able to solve in O(n), not able to solve in log(n).
-
Queue Reconstruction by Height
- First element: define height of person.
- Second element: position before.
- Example Input: [[7,0],[4,4],[7,1],[5,0],[6,1],[5,2]]
- Expected Output: [[5,0],[7,0],[6,1],[5,2],[4,4],[7,1]].
Result: Waiting for result.
Candidate's Approach
The candidate attempted to solve both problems but faced challenges with the second problem, particularly in achieving the desired time complexity. They provided a solution for the first problem but acknowledged it did not meet the log(n) requirement.
Interviewer's Feedback
The interviewer noted the candidate's effort in tackling the problems but highlighted the need for improvement in optimizing solutions. They encouraged the candidate to focus on time complexity in future problem-solving scenarios.