← 返回 uber 的题目列表Find Number of Joins in an Array
类型:online_judge
Given a 2D array arr, define two types of joins: 1. Rows and columns are completely identical; 2. All but the intersection are identical. Find the total number of joins in the array.
Example:
arr = [[1, 1, 1, 1], [1, 1, 1, 0], [2, 1, 3, 1]]
Output: 2
Explanation: The first row and the second column form a join (case1), and the second row and the fourth column form another join (case2).
Example
Input
arr = [[1, 1, 1, 1], [1, 1, 1, 0], [2, 1, 3, 1]]