Google L4 round 3 question
Anonymous User
727
You're given an array of size 14. You need to determine if the array is "gold".
What does "gold" mean?
You must use all 14 numbers exactly once.

There must be:
1 pair (two identical numbers),
4 sets, where each set is either:
A triplet of identical numbers [x, x, x], OR
A consecutive increasing triplet [x, x+1, x+2].

🧪 Step 2: Try Examples and Work Through
✅ Example 1:

nums = [1, 1, 2, 2, 2, 3, 3, 3, 4, 5, 6, 7, 8, 9]
Let's try to divide this:

Pair: [1, 1]

Set 1: [2, 2, 2] — triplet
Set 2: [3, 3, 3] — triplet
Set 3: [4, 5, 6] — consecutive
Set 4: [7, 8, 9] — consecutive

✅ Yes, this array is "gold".

follow up - So instead of 14 number you are given 13 number ,

You return -1 if you cannot enter any number to make it golden  array, and if you can return the number itself.
Comments (7)