Find the highest product between elements in a set
Test case that could be failing: {0,-1}.
In your case it returns 1 while it should have been 0.

About the algorithm:


Since you are already sorting it, just multiply everything except zero and first negative number. If its still negative multiply the first negative number.