Reported September 2026
Googlehash table

Find Duplicate Element Pairs

Reported by candidates from Google's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Google OA. Under 2s to a working solution.
Founder's read

Google's September 2026 OA hands you 2000 elements, three property strings each, and asks for every pair that shares at least one value. The input size looks friendly, so brute force tempts you. Don't trust it. This is a hash-table problem: invert the data so each property value points to the elements that carry it. If you blank on the structure during the live assessment, StealthCoder can run invisibly as a safety net and surface the approach. Know the inversion trick first and you won't need it.

The problem

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.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is an inverted index. Map each property value to the list of element indices that contain it. Then, for each value, every pair in its list is a duplicate pair. Collect pairs in a set keyed by the two indices, so two elements sharing several values only show up once. Dedupe each element's own three values first, since repeating a value inside one element must not create anything. Brute force compares all pairs of elements, about 2 million pairs times 9 string comparisons. That might pass at n=2000, but it's sloppy, and the index approach is cleaner. The real pitfall is the output order. Sort pairs by earlier index, then later index, and map back to ids. Also don't union chains. Example 2 says a-c must not appear. If you freeze live, StealthCoder is the hedge, but this one is easy to hand-roll.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Find Duplicate Element Pairs cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Google's OA.

Google reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Find Duplicate Element Pairs FAQ

How hard is Find Duplicate Element Pairs really?+

Easy to medium. The logic is one hash map and a set. The difficulty is in the details: dedupe within an element, avoid transitive chains, and sort the output correctly. Most failures come from those edge cases, not the core idea.

What's the trick for this Google OA question?+

Build a map from property value to the indices of elements holding it. Every two indices in the same bucket form a pair. Store pairs as (i, j) with i < j in a set so repeated shared values don't produce duplicates.

Does brute force pass with n up to 2000?+

Likely, since about 2 million pairs with a few comparisons each is manageable. But the inverted index is faster in typical cases and just as short to write. If a bucket is huge, the pair count is still bounded by n squared.

Should matches be transitive?+

No. Example 2 shows a matches b and b matches c, but a and c are not a pair. Only direct sharing of a property value counts. Don't use union-find or connected components here.

How do I get the output order right?+

Work with indices, not ids, until the end. Collect pairs as (i, j) with i < j, sort by i then j, then convert to ids. Sorting by id strings would break the required input-order ranking.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Google.

OA at Google?
Invisible during screen share
Get it