1899.cpp (455B)
1 class Solution { 2 public: 3 bool mergeTriplets(const vector<vector<int>> &triplets, const vector<int> &tgt) { 4 bool a = false, b = false, c = false; 5 for (const auto &tp : triplets) { 6 if (tp[0] > tgt[0] || tp[1] > tgt[1] || tp[2] > tgt[2]) continue; 7 if (tp[0] == tgt[0]) a = true; 8 if (tp[1] == tgt[1]) b = true; 9 if (tp[2] == tgt[2]) c = true; 10 } 11 return a && b && c; 12 } 13 };