Each row holds one night's observations. Keep nights separate while arranging each row from lowest to highest. The original grid must remain available in arrival order.
ordered_nights, return a sorted copy of each row using np.sort(grid, axis=1).Run main.py to check [2 5 7] and [1 6 9], then Submit. Here axis 1 means sorting across columns within each row, not sorting down a column.
Use np.sort, which returns a copy, rather than the in-place .sort() method.