Skip to main content
2 of 2
edited body
eldo
  • 84.8k
  • 6
  • 94
  • 210

Define your own ordering function:

f[_, 0] := 1 f[0, _] := -1 f[x_, y_] := x <= y Sort[#, f] & /@ in // MatrixForm 

enter image description here

eldo
  • 84.8k
  • 6
  • 94
  • 210