Objects Seen on Both Days by Multiple Clients
Updated
Problem statement
You are given two daily log files, represented by dayOneLogs and dayTwoLogs. Each row has exactly three strings: [timestamp, objectId, clientId].
Return every object ID that:
- appears in at least one record on each day, and
- is associated with at least two distinct client IDs across the two days combined.
Return qualifying object IDs in lexicographically increasing order. Duplicate log rows do not change the result.
Function
findRepeatedObjects(dayOneLogs: String[][], dayTwoLogs: String[][]) → String[]Examples
Example 1
dayOneLogs = [["09:00","objA","c1"],["09:10","objB","c2"],["09:20","objA","c1"]]dayTwoLogs = [["10:00","objA","c3"],["10:10","objB","c2"],["10:20","objC","c4"]]return = ["objA"]objA appears on both days and is associated with clients c1 and c3. objB has only one distinct client, and objC appears on only one day.
Example 2
dayOneLogs = [["1","x","a"],["2","y","b"],["3","y","c"]]dayTwoLogs = [["4","y","b"],["5","x","a"],["6","x","d"]]return = ["x","y"]Both objects appear on both days and each has at least two distinct clients across the combined records.
Example 3
dayOneLogs = []dayTwoLogs = [["1","x","a"]]return = []No object can appear on both days when the first file is empty.
Constraints
0 <= dayOneLogs.length, dayTwoLogs.length <= 200000.- Every row contains exactly three non-null strings.
- Every object ID and client ID is non-empty.
- The combined number of characters in each input is at most
2 * 10^6.
More Google Phone Screen questions
- Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Periodic-Color Binary Forest RootsPHONE SCREEN · Seen Nov 2026
- Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
- Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
- Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
- Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
- Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
Similar questions at other companies
- Rank Word-Translation Hints from Sentence TranslationsDuolingo · PHONE SCREEN · ONSITE INTERVIEWDuolingo interview questions
- Merge Sorted Squares of Two ArraysWhatNot · PHONE SCREEN · ONSITE INTERVIEWWhatNot interview questions
- Merge Weekday and Time IntervalsNextdoor · PHONE SCREENNextdoor interview questions
- 3SumAmazon · PHONE SCREEN
- Sort Ones, Twos, and Threes In PlaceAgoda · PHONE SCREEN · ONSITE INTERVIEWAgoda interview questions
- Group AnagramsWorkday · PHONE SCREEN
- Find All Pythagorean TripletsDell Technologies · PHONE SCREENDell Technologies interview questions
- Meeting Rooms IIUber · PHONE SCREENUber interview questions
- Sort a Quadratic-Transformed ArrayLinkedIn · PHONE SCREENLinkedIn interview questions
- Group AnagramsEPAM · PHONE SCREENEPAM interview questions