Maximum Consistent Columns in a Grid
Keep a subsequence of grid columns so that, in every row, neighbouring kept columns stay within a fixed limit. A chain DP over column pairs finds the longest such subsequence.
Keep a subsequence of grid columns so that, in every row, neighbouring kept columns stay within a fixed limit. A chain DP over column pairs finds the longest such subsequence.