If you select the Rubik’s Cube solver exercise, it says you’re finding the fastest solver, but then requires the following:
/* ----------------------------------- TO DO -----------------------------------
* Check if the parameter time is greater than fastestTime. If this is true,
* update fastestTime to the value passed to the parameter time.
* -----------------------------------------------------------------------------
*/
This will result in fastestTime taking on the largest time, which for any regular definition of time means it’s the slowest. I used the example solver list and, sure enough, it picks the slowest, Tanzer, as the person with the “fastest time”.
The lesson lets me complete with this idea. Switching the initial value of fastestTime to 65535 and the comparison to the following:
if(fastestTime > time){
fastestTime = time;
System.out.println(Integer.toString(time));
}
results in the fastest time being selected (363 centiseconds), but the code fails the built-in tests because they expect the incorrect comparison to have been used.