FastPrepFind Duplicate Element Pairs
Problems/Find Duplicate Element Pairs

Find Duplicate Element Pairs

Google logoGoogle● MediumINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report defines unique IDs, exactly three properties per element, and finding duplicates through a shared property value. It does not say whether to return direct pairs or linked groups, what position a property is in, the order, how to compare, what repeated properties mean, the input limits, or a function signature. Our version is about 92% the same as the reported question.

You are given ids.length elements. Element i has the unique identifier ids[i] and exactly three property values in properties[i].

Two distinct elements form a duplicate pair when they share at least one identical property value anywhere among their three properties. Duplicate pairing is direct: if element a matches b and b matches c, that chain alone does not make a and c a duplicate pair.

Return every duplicate identifier pair exactly once. Within each pair, place the earlier input element first. Order the returned pairs by the earlier input index and then by the later input index.

Property comparison is exact and case-sensitive. Repeating one property value inside an element does not duplicate an output pair.

Function

findDuplicatePairs(ids: String[], properties: String[][]) → String[][]

Examples

Example 1

ids = ["id1","id2","id3"]properties = [["p1","p2","p3"],["p1","p6","p5"],["p3","p7","p8"]]return = [["id1","id2"],["id1","id3"]]

id1 shares p1 with id2 and p3 with id3. The remaining pair shares no property.

Example 2

ids = ["a","b","c"]properties = [["x","p","q"],["x","y","r"],["y","s","t"]]return = [["a","b"],["b","c"]]

a matches b through x, and b matches c through y. The chain does not create an a-c pair.

Example 3

ids = ["left","right"]properties = [["a","b","c"],["d","e","f"]]return = []

The two elements share no property value, so there are no duplicate pairs.

Constraints

  • 1 <= ids.length = properties.length <= 2000.
  • Every identifier is unique.
  • properties[i].length = 3.
  • Identifiers and property values are non-empty strings of at most 30 printable ASCII characters.
  • Property comparison is case-sensitive.

More Google Onsite Interview questions

  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Distinct Subset SumsONSITE INTERVIEW · Seen Nov 2026
  • Playlist With No Same Artist in a RowONSITE INTERVIEW · Seen Nov 2026
  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • First and Last Target Position in a Mountain ArrayONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
  • Batched Subsequence Word MatchesONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Longest Consecutive Login StreakAmazon · ONSITE INTERVIEW
  • Group AnagramsMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Deep Merge with a Conflict ResolverAutodesk · ONSITE INTERVIEWAutodesk interview questions
  • Group Duplicate Files by ContentPostman · ONSITE INTERVIEWPostman interview questions
  • Group AnagramsGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
  • Group AnagramsMotive · PHONE SCREEN · ONSITE INTERVIEWMotive interview questions
  • Group AnagramsBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Group AnagramsExpedia · ONSITE INTERVIEWExpedia interview questions
  • Group AnagramsAkuna Capital · ONSITE INTERVIEWAkuna Capital interview questions
  • Group Anagram StringsLondon Stock Exchange · ONSITE INTERVIEWLondon Stock Exchange interview questions

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public String[][] findDuplicatePairs(String[] ids, String[][] properties) {
        // Return every directly duplicate pair in input-index order.
    }
}
Checking account…