Here is the common hash table solution which reduces the time/iterations from n^4 to n^2 with trade off of n^2 space usage. But there is a clue/tag on problem which calls for Binary Search. Any idea what that is hinting at?

Also it says the lengths are all equal but the only thing I can think of as to why they mention that is so we don't have to check which arrays to pair for the looping. You'd want to pair arrays so that the total iterations for each of the steps (product of lengths) is as equal as possible.

```
public int FourSumCount(int[] A, int[] B, int[] C, int[] D)
{
Dictionary<int,int> countsCD = new Dictionary<int,int>();
foreach (int c in C)
{
foreach (int d in D)
{
int sum = c + d;
countsCD[sum] = 1 + (countsCD.ContainsKey(sum) ? countsCD[sum] : 0);
}
}
int count = 0;
foreach (int a in A)
{
foreach (int b in B)
{
int diff = -(a + b);
count += countsCD.ContainsKey(diff) ? countsCD[diff] : 0;
}
}
return count;
}
```