← 返回 uber 的题目列表Find Combinations After Flip
类型:online_judge
Given an array of integers, compute the number of combinations after flipping operations. Use a hash map to track the occurrences of num - flip(num) and compute combination options.
Input:
An array of integers arr
Output:
Count of the combinations
Example:
find_combinations([1, 3, 2, 3]) # Returns 4
find_combinations([1, 1, 1]) # Returns 3
Constraints:
The maximum length of arr is 10000
Example
Input
[1, 3, 2, 3]