Swapping Matrix (Contest)
Swapping Matrix (Contest) easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Swapping Matrix (Contest) easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
You are given a 7 * 7 matrix of 48 zeroes and a single 1. In one move, you can swap any two adjacent rows or columns. Find the minimum number of moves required to bring the single 1 to the middle of the matrix. Input The input consists of 7 lines where each line contains 7 space-separated integers.
Constraints: 48 zeroes and a single one is present in the matrix. Output Print the minimum number of moves required to bring the single 1 to the middle of the matrix. Example Sample Input: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Sample Output: 2
link: