Goldman Sachs | Phone Screen | Parse / Filter Logs | CLEAN Code Challenge
Anonymous User
3282
data = [
  ("Whole Foods", 48.11, 5),
  ("Comcast", 89.99, 10),
  ("Comcast", 89.99, 20),
  ("Comcast", 89.99, 30),
  ("T-Mobile", 40.00, 45),
  ("T-Mobile", 40.00, 55),
  ("T-Mobile", 40.33, 65),
  ("Jetblue", 20.11, 80),
  ("Jetblue", 20.11, 90),
  ("Jetblue", 20.11, 95),
]
-> [ “Comcast” ]

Question:
Each line represents a COMPANY, AMOUNT, DAY
Return a list of companies which are "persistent".

For this problem, a "persistent" company means:

  • There are 3+ transactions with the same company, same price, and the same interval of time b/w transaction

A company is not "persistent" if any one of the transactions:

  • Is at a diff interval from the rest, ex Jetblue
  • Is a diff price from the rest, ex. T-Mobile
  • Is not in a set of 3+, ex. Whole Foods

Context:
I've gotten variations of this question at 3 different fintech companies. Parsing / filtering data from logs or streams. It's worth preparing for. It's not about algorithmic complexity (O(n)), rather clean / well structured / readable code.

Comments (11)