Decagon·Software Engineer·Technical Phone Screen
- Design a CSAT (Customer Satisfaction) tracker class that accepts a sliding time window. It should support: initializing with a window size, recording a conversation ID with a score (1-5) and a strictly increasing timestamp, and returning the average score of all entries within the current active window rounded to 2 decimal places.
- Follow-up: add an update method that takes a conversation ID and a new score. If the conversation is still within the active window, update its score. If it has expired, do nothing. The original timestamp and ordering should remain unchanged.
- Second follow-up: add a percentile method that, given an integer p, returns the score at that percentile across all conversations currently in the active window.
“I'd done something like this before so I felt confident going in.”