FastPrepFirst Three Badge Times per User
Problems/First Three Badge Times per User

First Three Badge Times per User

Wayfair logoWayfair● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The reported task of the first three clock-in and clock-out times matches at about 85%, keeping both actions and users with fewer than three records. The timestamps in the report are symbols and give no numbers. Choosing by time order, keeping duplicates, typed records, the order of IDs and output, writing decimals in one standard form, the empty case and finite limits are our choices. A comment proposing a C# timestamp key is not a clarification from the original author. Wayfair is the hiring company and Karat the provider.

Each row of records is [userID,timestamp,action], recording either clockin or clockout. Return the first three times for every represented user, or all of that user's times if they have fewer than three.

For this exercise, assume first means the earliest numeric timestamps, regardless of input order. Both actions count. Every occurrence counts separately, including identical rows or events with equal timestamps. No matching or alternating action sequence is required.

For this exercise, assume the result contains one row [userID,time1,...] per user. Treat IDs as complete case-sensitive strings, so different leading-zero spellings identify different users. Sort rows by ASCII user ID and selected times numerically ascending. Write times as decimal strings without leading zeros. Empty input returns an empty array.

Function

firstThreeTimes(records: String[][]) → String[][]

Examples

Example 1

records = [["A","1","clockin"],["B","2","clockout"],["C","3","clockin"]]return = [["A","1"],["B","2"],["C","3"]]

Each represented user has only one event; both action types contribute a timestamp.

Example 2

records = [["Ada","9","clockout"],["Ben","4","clockin"],["Ada","3","clockin"],["Ada","3","clockout"],["Ada","1","clockin"],["Ben","2","clockout"]]return = [["Ada","1","3","3"],["Ben","2","4"]]

Ada has four records, so keep 1,3,3. Ben has two and retains both 2,4. Rows are ordered by user ID.

Constraints

  • For this exercise, assume 0 <= records.length <= 200. Each row has exactly three strings.
  • For this exercise, assume user IDs contain 1 through 30 ASCII letters, digits or underscores. IDs are case-sensitive.
  • For this exercise, assume timestamps have 1 through 10 decimal digits, may have leading zeros, and have values from 0 through 1000000000. Actions are clockin or clockout; fields contain no whitespace.

More Wayfair interview questions

  • Container With Most WaterPHONE SCREEN · Seen Sep 2026
  • Assign Distinct Letter Values to Minimize XORPHONE SCREEN · Seen Sep 2026
  • Time of Maximum Mall OccupancyPHONE SCREEN · Seen Apr 2022
  • Longest Common Contiguous User ActionsPHONE SCREEN · Seen Apr 2022
  • Count a Person’s Distinct FriendsPHONE SCREEN · Seen Mar 2022
  • Word Path Moving Only Right or DownPHONE SCREEN · Seen Mar 2022
  • Tree Nodes with Zero or One ParentPHONE SCREEN · Seen Sep 2021
  • UCB1 Multi-Armed Bandit TraceONSITE INTERVIEW · Seen Sep 2026
  • Moving Cost by Volume and CategoryONSITE INTERVIEW · Seen Sep 2026
  • DFS Subsequences of a String (For MLE)OA · Seen Sep 2024

Similar questions at other companies

  • Top K Frequent ElementsAmazon · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Mutual-Friend Referral RecommendationsFireworks AI · PHONE SCREEN · ONSITE INTERVIEW
  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Filter, Sort, and Deduplicate Scheduled TasksRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • Log Analyzer: Busiest Service in a Rolling WindowByteDance · PHONE SCREENByteDance interview questions
  • User Journey PathsWhatNot · PHONE SCREEN · ONSITE INTERVIEWWhatNot interview questions
  • Merchant Payout Scheduler, Part 2: Per-Merchant SchedulesStripe · PHONE SCREENStripe interview questions
  • Longest Consecutive SequenceJP Morgan Chase · PHONE SCREENJP Morgan Chase interview questions
  • Top K Frequent Elements with a Recency TiebreakSwiggy · PHONE SCREEN
All Wayfair interview questionsSee Wayfair hiring insights
Saved
class Solution {
    public String[][] firstThreeTimes(String[][] records) {
        // Write your code here.
        return new String[0][];
    }
}
Checking account…