I have read grid compression from this Quora link. But I didn't get the technique by which a grid can be compressed. I know the implementation of 1-D coordinate compression by using binary search technique, but I am not getting how a 2D grid can be compressed.
Here is the problem that I am trying to solve
where each row/column have they own weight — the number of such equal lines so you can compress the table in 150c from 10^9x10^9 to ~10^3x10^3