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:
A company is not "persistent" if any one of the transactions:
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.