Ad
  • Custom User Avatar
    1. You have a number n(let's say 10) and you need to square all numbers from 0(including) to 10(including).
      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 --> 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100

    2. Let's say that we want the digit '1'. In squared array we need to sum up all digits that are '1'. (Keep in mind that if we have, for example, squared number 121, that has two digits '1', then we are adding both of them to the final sum/counter).
      0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 -->
      0, 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 1 = 4

    I hope this helps. :)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution