FastPrepUnique Users Within Each IP Address
Problems/Unique Users Within Each IP Address

Unique Users Within Each IP Address

Roblox logoRoblox● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Roblox new grad onsite interview. The report counts unique users by leaving out names that are a prefix of another name at the same IP. We chose strict prefixes, how to handle repeated pairs, the output order, the label syntax, and the limits. Our version is about 90% the same as the reported question.

You are given parallel arrays ips and names. Each position describes a username seen at that IP address. A user counts as unique at an IP if no longer name at that IP starts with the user’s full name.

For this exercise, assume exact duplicate (IP, name) pairs describe the same user. Equal names do not exclude one another, and comparisons are case-sensitive. A name at a different IP cannot exclude this user.

Return one [IP, name] row for every surviving distinct pair, in the order its first occurrence appears in the input. If a name is a prefix of a longer name at its IP, omit all occurrences of that pair. Empty inputs return an empty array. Treat each IP label as an identifier. You do not need to parse it as an address.

Function

uniqueIpUsers(ips: String[], names: String[]) → String[][]

Examples

Example 1

ips = ["a","a","b","a"]names = ["ann","anna","ann","bob"]return = [["a","anna"],["b","ann"],["a","bob"]]

At IP a, ann prefixes anna. The same name at IP b has no longer competitor and remains.

Example 2

ips = ["x","x","x","y"]names = ["alex","alex","al","al"]return = [["x","alex"],["y","al"]]

Duplicate x/alex appears once. x/al is excluded by alex, while y/al is independent.

Example 3

ips = []names = []return = []

No observations produce no users.

Constraints

  • 0 <= ips.length <= 500 and names.length = ips.length.
  • Each IP label has 1 to 40 characters, using English letters, digits, periods, colons or underscores.
  • Each name has 1 to 40 English letters or digits.

More Roblox Onsite Interview questions

  • Most Frequent Call Path From Function Trace LogsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Search Autocomplete SystemPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Candy Crush Grid Matching and GravityPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Topological Sort with Secondary OrderingPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Most Frequent Call Stack Per ThreadPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Count and Score Distinct Hat AssignmentsONSITE INTERVIEW · Seen Sep 2026
  • Rate Limiter Sliding Window With Per-Entity LimitsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Most Frequent Call Path in Interleaved LogsONSITE INTERVIEW · Seen Aug 2026
  • Grid Pathfinding with Obstacles (DFS)PHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2026
  • Maximize Distance to Closest Person — Return the SeatONSITE INTERVIEW · Seen Jun 2026

Similar questions at other companies

  • Group AnagramsAmazon Web Services · ONSITE INTERVIEWAmazon Web Services interview questions
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • Longest Consecutive Login StreakAmazon · ONSITE INTERVIEW
  • Transform Dotted Keys into a Nested MapProofpoint · ONSITE INTERVIEW
  • Serialize and Deserialize a String Key-Value StoreByteDance · ONSITE INTERVIEWByteDance interview questions
  • Group AnagramsMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Build an Inverted Document IndexConfluent · ONSITE INTERVIEWConfluent interview questions
  • Find Duplicate Element PairsGoogle · ONSITE INTERVIEWGoogle interview questions
  • Filesystem Hash TreeCursor · PHONE SCREEN · ONSITE INTERVIEWCursor interview questions
  • Sort Characters by FrequencySnap Inc. · ONSITE INTERVIEWSnap Inc. interview questions

Interview reports that mention this question

  • Roblox New Grad HackerRank OA: 18 Experiences (Part 5 of 7)

Roblox interview experiences

  • Roblox OA: What It Tests (2026)
  • Roblox New Grad Early OA Tasks: 10 Experiences (Part 7 of 7)
  • Roblox New Grad Engineer Rounds: 13 Experiences (Part 6 of 7)
  • Roblox New Grad CodeSignal Finals: 23 Experiences (Part 4 of 7)
  • Roblox New Grad Games and BQ: 25 Experiences (Part 3 of 7)
All Roblox interview questionsSee Roblox hiring insights
Saved
class Solution {
    public String[][] uniqueIpUsers(String[] ips, String[] names) {
        // write your code here
    }

}
Checking account…