Mubashir needs your help to find out a wrong number in a 2D list.
Imagine a 2D list of numbers given below:
lst = [
[1, 2, 3, 6 ],
[4, 5, 6, 15],
[7, 8, 9, 24],
[12,15,18,45]
]
You can notice that:
See below examples for a better understanding:
lst1 = [
[2, 2, 3, 6 ],
[4, 5, 6, 15],
[7, 8, 9, 24],
[12,15,18,45]
]
# 2 is incorrect in first row and first column.
# Replace it with 1.
lst2 = [
[1, 2, 3, 7 ],
[4, 5, 6, 15],
[7, 8, 9, 24],
[12,15,18,45]
]
# 7 is incorrect in first row and fourth column.
# Replace it with 6.
lst3 = [
[1, 2, 3, 6 ],
[4, 5, 6, 15],
[7, 8, 9, 24],
[12,15,18,46]
]
# 46 is incorrect in fourth row and fourth column.
# Replace it with 45.
wrong_number(arr1) ➞ 1
wrong_number(arr2) ➞ 6
wrong_number(arr3) ➞ 45
N/A