FastPrepFirst Unique Log Entry
Problems/First Unique Log Entry

First Unique Log Entry

Uber logoUber● EasyFULLTIMEONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

You are given process logs in arrival order. Treat each log as a full string entry.

Return the first log entry that appears exactly once in the entire sequence. If no such log exists, return an empty string.

Function

findFirstUniqueLog(logs: String[]) → String

Complete the function findFirstUniqueLog in the editor below.

findFirstUniqueLog has the following parameter:

  1. String[] logs: the process logs in arrival order

Returns String: the first log whose final frequency is exactly one, or "" if none exists.

Examples

Example 1

logs = ["A", "B", "A", "C", "B"]return = "C"

A and B each appear twice. C is the first log whose total frequency is exactly one.

Example 2

logs = ["x", "y", "x", "y"]return = ""

Every log appears more than once, so there is no unique entry.

Constraints

  • 1 <= logs.length <= 10^6
  • Each log entry is treated as an entire string and may contain spaces.
  • The answer is based on the original order among log entries whose final count is exactly one.

More Uber problems

  • Worst-Performing Ads by CTR in a Campaign TreePHONE SCREEN · Seen Nov 2026
  • Earliest Time All Users Are ConnectedPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Max Points on a LinePHONE SCREEN · Seen Oct 2026
All Uber interview questionsSee Uber hiring insights
Saved
class Solution {
    public String findFirstUniqueLog(String[] logs) {
        // write your code here
    }

}
Checking account…