Mistake in the Solution of Project Euler 99

I think there is a mistake in the solution proposed of the Problem 99 because it seems to me it doesn’t check the first item in the array.

For this reason the test done with testArray1 fails because the solution is [492798,527927] (the first item) while the solution reported on the page of the problem says " largestExponential(testArray1) should return [840237, 507276]" and you can check that this is false by comparing these two in Wolfram Alpha.

Code in the guide

function largestExponential(baseExp) {
  let maximum = 0;
  let indexOfMaximum = 0;
  for (let i = 1; i < baseExp.length; i++) {  // I think 'i' should start from 0
    const curValue = Math.log(baseExp[i][0]) * baseExp[i][1];
    if (curValue > maximum) {
      maximum = curValue;
      indexOfMaximum = i;

  return baseExp[indexOfMaximum];

Challenge: Problem 99: Largest exponential

Link to the challenge:

1 Like

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.