Problem 29: Distinct powersPassed

What is your hint or solution suggestion?

solution
function distinctPowers(n) {
  let array = [];
  for(let i = 2; i <= n; i++){
    for(let j = 2; j <= n; j++){
      if(!array.includes(Math.pow(i, j))){
        array.push(Math.pow(i, j));
      }
    }
  }
  return array.length;
}

Challenge: Problem 29: Distinct powers

Link to the challenge:

if you also want to contribute to the guide please open your own topic, thank you

1 Like

Thank you for your guide post contribution. I have taken your suggestions and included them in the guide post.

We look forward to your further contribution.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.