Ad
  • Custom User Avatar

    Once solved, you can check out the author's (@myjinxin2015) solution to see how they did it without the need for BigInt or imported modules.

  • Custom User Avatar

    There are libraries which help with that (bignumber.js or native support for big numbers available since Node 10) but if you are going to calculate n^n, it won't really help you. The number will get so big, you will run out of memory.
    Additionally, if you structure your solution correctly, you will not even need big numbers. This problem can be solved in domain well below Number.MAX_SAFE_INTEGER.