PhonePe | SDE2 | Bangalore | March 2022 | Reject
Anonymous User
3968

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)] 

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 (5)