testing binary matrix having consecutive ones in every row

I was solving some of the programming problems recently i came up the problem i could solve in expo time could you help me to solve in poly time
question: Given a binary matrix we have to say ‘yes’ if there exits a permutation of columns such that all the ones should come together in every row . for some matrices it is not possible we have can so ‘no’ to that instances .
could you please help out how to start solving this

question link please?

Google Photos
this is not a direct question but a part i have given an example please look at it