Problem
A triplet is a list of three integers. You get a list triplets of triplets and one more triplet, target.
You can do this operation any number of times. Choose two different indexes i and j. Let triplets[i] be [a1, b1, c1] and triplets[j] be [a2, b2, c2]. Then change triplets[j] to [max(a1, a2), max(b1, b2), max(c1, c2)].
Return true if one of the triplets can become equal to target. Otherwise, return false.
Example 1
- Input:
- triplets = [[1,4,2],[3,1,5],[3,4,9]], target = [3,4,5]
- Output:
- true
- Explanation:
- Merge
[1, 4, 2]and[3, 1, 5]. The result is[3, 4, 5], which is the target.
Example 2
- Input:
- triplets = [[2,6,1],[1,2,3]], target = [2,2,3]
- Output:
- false
- Explanation:
- Any merge with
[2, 6, 1]gives a middle value of at least 6, which is larger than 2. The triplet[1, 2, 3]alone does not match the target.
Constraints
- 1 <= triplets.length <= 10^5
- triplets[i].length == target.length == 3
- 1 <= triplets[i][k], target[k] <= 1000
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1899. Merge Triplets to Form Target Triplet
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source