PhonePe Senior SDE bengaluru [Exp 7+]

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2024-12-02Added By Anonymous
Source:Β Link
🧭 Experience: unknown βœ… Outcome: unknown πŸ’° Compensation: unknown πŸ“ Location: Bengaluru 🏒 Company: PhonePe πŸŽ“ Education: unknown 🎁 Benefits: unknown πŸ“… Offer Date: unknown

Round-1 :- design round Design a payment transisiton 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: 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 i.e. anything in one journey won’t depend on any other journey. ourneys can be of 2 types, time-bound (having a start-date, end-date) and perpetual (no validity and will remain live till it’s active). 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. We will have to mark the journey as active for it to be picked as part of the evaluation. By default on journey creation, it should be inactive. Also when the validity period of a journey is over, mark it inactive for time-bound journeys. Example: There are 2 Journeys: 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 an upi lite account. For stage 2 is the user doing a top up on their upi lite account. Let's say there are 3 users: User 1: Logins to the app, hence is on stage 1 of J1. User opens the recharge page, at this time the user moves to stage 2 of J1. User 2: Logins to the app, hence is on stage 1 of J1. User opens the recharge page, at this time the user moves to stage 2 of J1 and then does a recharge transaction and is finally moved to stage 3 of J1 User 3: Logins to the app, hence is on stage 1 of J1. User opens up an upi account and is onboarded to J2. So at this point of time, User 1 is at stage 2 of J1, User 2 is at stage 3 of J1 and User 3 is at stage 1 of J1 and stage 1 of J2. Mandatory Implementations: createJourney(Journey journey) This will help in creating a journey in the system. updateState(String JourneyId, boolean active) Mark journey as active/inactive. getJourney(String journeyId) To get the journey details evaluate(String userId, Payload payload) Input payload can contain some fixed params and a Map of <key, value> Basis the payload, 3 things may happen: The payload may match the condition for onboarding the user to a journey. In this case, the user will get onboarded to the journey. The payload may match the condition required for moving to the next stage for a user already onboarded on a specific stage. In this case, the user will move to the next stage in that journey. The payload will not match any condition, in this case it will be simply ignored. Users onboarding/transitions in a journey will happen only when the journey is ACTIVE. getCurrentStage(String userId, String journeyId) Find the current stage of a user in the given journey id. isOnboarded(String userId, String journeyId) Return true/false basis on the condition that whether the user is part of the journey or not. Optional 1: Provide a way where we can send SMS to a user as soon as any stage transition happens for that user (onboarding to the journey or moving from one stage to another). It should have the capability to decide for which stage we want to provide this feature. Optional 2: Add support for recurring journeys, where a single user can onboard the journey multiple times. Why the journey service? This service serves as a platform for creating multiple journeys for different user paths and tracking users along the journey, taking business decisions accordingly in real time without the need of heavy database queries. Additionally, the service can trigger actions when users transition between stages or remain stationary at a particular stage for an extended period. For example, it can send notifications to users who have viewed a product but haven't made a purchase. System Architecture: Imagine all the events of the entire product systems flowing to some message queue, and the journey service acting as one of the consumers of the messages. All the messages flowing in are being evaluated (as per the evaluate(String userId, Payload payload)) and this service keeping track of the user and journey status for real time use case by different product systems using getCurrentStage(String userId, String journeyId) 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. it is of 2 hour round time I have submitted my code followup with interview Result:-CLEARED Round2 :-High level system design Design a flight aggregator service features:- 1)Need to provide search of flight 2)Need to optimize flight searching and resheduling 3)Need to tell techstack and code flow Result:-CLeared Round-3:- Problem solving 1 2 3 4 https://leetcode.com/problems/complete-binary-tree-inserter/description/ ouput:- need to return the next element 5 plus the parentNode trick:- is dont give O(n) solution want log(n) solution able to solve in o(n) not able to solve in log(n) Q. I:- [[7,0],[4,4],[7,1],[5,0],[6,1],[5,2]] https://leetcode.com/problems/queue-reconstruction-by-height/description/ first element :- define height of person second elemtn:- position before where the 4,4 means 4 people is stand above which has height greater than 4 =[5,7,6,5] o:- [[5,0],[7,0],[6,1],[5,2],[4,4],[7,1]] Result:-Waiting for result as not able to solve any one . DataStructure and problem solving + (Machine coding ) round is hard
Comments