Diferente pentru blog/meet-in-the-middle intre reviziile #67 si #66

Nu exista diferente intre titluri.

Diferente intre continut:

The naive algorithm tries all the possible combinations of four numbers. This solution takes $O(N^4^)$ time.
A less naive algorithm brute forces through all $n^3^$ combinations of three numbers and then efficiently checks if -(a + b + c) is in the original array using a hash table. This algorithm has $O(n^3^)$ complexity.
A less naive algorithm brute forces through all $n^3^$ combinations of three numbers and then efficiently checks if their sum is in the original array using a hash table. This algorithm has $O(n^3^)$ complexity.
By now, you’ve probably started thinking how meet in the middle can be applied to this problem. The trick is to rewrite the equation as $a + b = -(c + d)$. Store all the $n^2^$ sums $a + b$ in a hash set $S$. Then iterate through all $n^2^$ combinations for c and d and check if $S$ contains -(c + d).

Nu exista diferente intre securitate.

Topicul de forum nu a fost schimbat.