Block (Square) | Coderpad 1st round | Duplicate pairs

I applied for a senior position and was asked two questions in my first round:

  1. "Given a list of employees match each employee with another and return a list containing the pairs". I simply matched one employee with the next one, mentioning the corner case of having an odd number of employees. I was also asked to implement a unit test to verify my solution.
  2. This question was basically "Make sure that you can request the list of pairs in problem 1) multiple times without ever getting duplicate pairs". I used a dictionary associating each employee to a list of available employees in order to keep track of the previous matches, but I didn't have time to complete my solution so I didn't pass. I solved it later on my own and I used a temporary stack to pop employees from and match them in order to avoid re-matching the same employees. For instance, if I match Robert with Susy I need to make sure I don't also match Susy with someone else in the same call.

I know that interview problems tend to resemble a number of patterns related to Leetcode types of problems but I can't figure out which pattern problem 2) belongs to. Can anyone help me with this?

Comments (5)