Problem
You have a list of triplets, each [a, b, c], and a target triplet. One operation picks two triplets and replaces one of them with their element-wise maximum: [max(a1, a2), max(b1, b2), max(c1, c2)]. You may do this any number of times. Return true if target can appear in the list.
Example 1
- Input
- triplets = [[2, 5, 3], [1, 8, 4], [1, 7, 5]], target = [2, 7, 5]
- Output
- true
- Why
- merge the first and third
Example 2
- Input
- triplets = [[3, 4, 5], [4, 5, 6]], target = [3, 2, 5]
- Output
- false
Constraints
1 <= triplets.length <= 10^5triplets[i].length == target.length == 31 <= a, b, c, target[j] <= 1000