Sorting a binary 2D matrix?

前端 未结 6 1255
伪装坚强ぢ
伪装坚强ぢ 2021-02-09 13:06

I\'m looking for some pointers here as I don\'t quite know where to start researching this one.

I have a 2D matrix with 0 or 1 in each cell, such as:

  1         


        
6条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-09 13:45

    Here's a starting point:

    Convert each row from binary bits into a number

    Sort the numbers in descending order.

    Then convert each row back to binary.

提交回复
热议问题