I got the idea to solve ZCO15003 using the greedy method but I am finding it difficult to code in Java.

My method:

- Sort the 2d array based on closing interval.
- take the closing interval of the first element in array
- Iterate over the array checking if its fits in that interval and if it fits then remove it from array
- the final answer is the size of the array.

Any leads are appreciated.