Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rowsRearranging(matrix)
- sorted_array = Array.new
- sorted_array = matrix.sort
- x_length = matrix.length
- y_length = matrix[0].length
- x = 0
- y = 0
- if x_length == 1 or y_length == 1 then
- return true
- end
- while (y < y_length)
- while (x < x_length - 1)
- if sorted_array[x + 1][y] <= sorted_array[x][y] then
- return false
- end
- x = x + 1
- end
- x = 0
- y = y + 1
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment