There is an array of frogs in a line, with a gap position on the center which they can leap to. Frogs on the left side leaps to right, and right side frogs jumps to left. Find all the solutions to the problem.
frogs.cpp // c++ implementation that find the solution. frogs.js // javascript implementation that find the solution.
Environment: gcc 4.7.2, node.js 4.1.2