Project Euler #172: Investigating numbers with few repeated digits

  • + 0 comments

    In the code you provided, the mistake lies in reusing the variable name tot for two different purposes within the same scope. This leads to incorrect results in the output.

    The mistake was in using tot as both the total number of inputs and the count of digits to be subtracted (totalCount). By reusing the same variable, the value of tot was being overwritten, leading to incorrect calculations. I've renamed the variable that holds the total count of digits to totalCount to avoid this issue.