Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
110% efficiency
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.
Oh cool, I didn't know you could import libraries. Thanks for the advice; I've found some clues about modular arithmetic which I think will help.
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 calculaten^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
.Any tips on how to work with big numbers in JS? Some of the tests produce integers in scientific notation which I can't seem to figure out how to deal with.