'How to find sequences of valid tuples

I have n tuples (x_i, y_i, z_i). I want to find the minimum number of sequences such that each tuple in the sequence (x_i, y_i, z_i) and (x_j, y_j, z_j) is such that x_i >= x_j, y_i >= y_j, and z_i >= z_j. All n tuples must be assigned to one and only one sequence.

For example, if I had three tuples with values (1, 2, 3), (2, 2, 3), and (1, 1, 7), the minimum number of valid sequences is 2, which are (2, 2, 3) and (1, 2, 3) and (1, 1, 7) by itself.

I want to find an algorithm that can return this minimum number in O(n^3) time. I was considering checking each tuple against each other tuple but there must be a more efficient way to solve this. Any pointers would be appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source