FastPrepNormalize and Aggregate Error Logs
Problems/Normalize and Aggregate Error Logs

Normalize and Aggregate Error Logs

Temporal logoTemporal● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand Temporal phone interview report from February 11, 2026 asks candidates to parse logs with a timestamp, error code, link, and API. You replace the digits in the link with '#', and output the error code, API, link, and a count. We group by the three fields left after dropping the time, which is the smallest setup that gives one answer. Our version is about 92% the same as the reported question.

Each log is encoded as timestamp|errorCode|link|api. Normalize its link by replacing every decimal digit with #, then group logs with the same error code, API, and normalized link.

Return one row per group as errorCode|api|normalizedLink|count, sorted lexicographically by the complete first three fields.

Function

aggregateErrors(logs: String[]) → String[]

Examples

Example 1

logs = ["10|E1|/users/123|GET","11|E1|/users/456|GET","12|E2|/users/123|GET"]return = ["E1|GET|/users/###|2","E2|GET|/users/###|1"]

The two E1 links normalize to the same tuple.

Example 2

logs = ["1|ERR|/v2/a9|POST","2|ERR|/v20/a8|POST"]return = ["ERR|POST|/v##/a#|1","ERR|POST|/v#/a#|1"]

Digit replacement preserves how many digits each link contained and the rows are sorted lexicographically.

Example 3

logs = ["1|A|/x|GET"]return = ["A|GET|/x|1"]

A link without digits is unchanged.

Constraints

  • 1 <= logs.length <= 200000.
  • Every log has exactly four non-empty fields separated by |.
  • Fields contain printable ASCII characters other than |; each log is at most 500 characters.

More Temporal interview questions

  • Concurrent Volley ShotPHONE SCREEN · Seen Apr 2026
  • Concurrent Web Crawler ReachabilityPHONE SCREEN · Seen Oct 2025
  • Delayed Task Executor OrderingPHONE SCREEN · Seen May 2025
  • Game of Life Next GenerationONSITE INTERVIEW · Seen Oct 2025

Similar questions at other companies

  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • Group AnagramsWorkday · PHONE SCREEN
  • Bank Account Balances (Part 2): Monthly ReconciliationStripe · PHONE SCREENStripe interview questions
  • Time-Aware Search AutocompleteRoblox · PHONE SCREENRoblox interview questions
  • Top Ten Most Frequent Words in a BookRobinhood · PHONE SCREENRobinhood interview questions
  • Group AnagramsEPAM · PHONE SCREENEPAM interview questions
  • Aggregate Matching IPv4 Addresses Across ResponsesPinterest · PHONE SCREENPinterest interview questions
  • Diff Two Filesystem Hash TreesCursor · PHONE SCREENCursor interview questions
  • Find Duplicate File GroupsAnthropic · PHONE SCREENAnthropic interview questions
  • Group AnagramsJFrog · PHONE SCREEN
All Temporal interview questionsSee Temporal hiring insights
Saved
class Solution {
    public String[] aggregateErrors(String[] logs) {
        // write your code here
    }
}
Checking account…