1899. Merge Triplets to Form Target Triplet
Practice Merge Triplets to Form Target Triplet for free on NudgeCode: Medium, Greedy pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
You have a list of triplets [a, b, c]. One operation picks two triplets i and j and replaces triplet j with their element-wise maximum. Return true if, after any number of operations, some triplet can equal target.
Example
triplets = [[2,5,3],[1,8,4],[1,7,5]], target = [2,7,5] -> true
triplets = [[3,4,5],[4,5,6]], target = [3,2,5] -> false
Constraints
- 1 <= triplets.length <= 10^5
- 1 <= every value <= 1000