PhonePe | SDE2 | Bangalore | March 2022 | Reject

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2022-05-06Added By Anonymous
Source:ย Link
๐Ÿงญ Experience: unknown โœ… Outcome: Reject ๐Ÿ’ฐ Compensation: unknown ๐Ÿ“ Location: Bangalore ๐Ÿข Company: PhonePe ๐ŸŽ“ Education: unknown ๐ŸŽ Benefits: unknown ๐Ÿ“… Offer Date: unknown Screening (LLD) - Using an n-byte array create an in-memory filesystem that supports: - create_file(filename, content) - read_file(filename) - delete_file(filename) - update_file(filename, content) - Good to have: - Add content ecryption/decryption logic - Handling concurrency Round1: DS/Algo - Q1: People were stading in a queue. Because of panic they scattered away. They were made to stand again in a queue. Now, theyโ€™re not standing in their original positions. - Luckily a person was able to create a list of peopleโ€™s height (h) with the number of people with height >=h standing in front of them. - Return the original queue, if itโ€™s possible to create it. - e.g. hereโ€™s the original queue with height of each person: `5 4 5 7 3` ``` # you've been given list of (height h, num. of people standing in front that had height >= h): 5 0 # 0=[] since no one standing in front 4 1 # 1=[5] 5 1 # 1=[5] 7 0 # 0=[] since no one >=7 3 4 # 4=[5,4,5,7] ``` - My solution: - Let the given list be a list of tuples: (height, num) - Sort this list with a custom comparator that: 1. sorts by num 2. for equal num, sorts by height - Starting from the beginning of the list insert it in a doubly linked list - Need to find the correct position of each element by using num - Keep doing this ``` # after sorting: 5 0 7 0 4 1 5 1 3 4 # doubly linked list with each iteration: [(5,0)] [(5,0) (7,0)] [(5,0) (4,1) (7,0)] # since in (4, 1), there's one element >= 4 in front of 4 [(5,0) (4,1) (5,1) (7,0)] # since in (5,1), there's one element >= 5 AND you CANNOT place it before (4,1) because (4,1) can only have one element >=4 in front of it [(5,0) (4,1) (5,1), (7,0) (3,4)] ``` - Q2: https://leetcode.com/discuss/interview-question/357011/phonepe-insert-a-node-in-complete-binary-tree Round2: HLD - Design a Swiggy like application Round3: Hiring Manager - Behavioural questions + why i want to join PhonePe - HLD of a big feature that I worked on in my current organization
Comments