Matrix Cells In Distance Order

easy
1. You are given four integers row, cols, rCenter, and cCenter. There is a rows x cols matrix and you are on the cell with the coordinates (rCenter, cCenter).
2. Return the coordinates of all cells in the matrix, sorted by their distance from (rCenter, cCenter) from the smallest distance to the largest distance.

Input Format

Input is managed for you

Output Format

Output is managed for you

Constraints

1 <= rows, cols <= 100
0 < rCenter < rows
0 < cCenter < cols

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
2 3 1 2
Output
(1, 2), (0, 2), (1, 1), (0, 1), (1, 0), (0, 0),
Previous
Pillars
Next
Finding Mino

Related Questions