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.
your first approach is not good enough because its complexity is not sufficient. you need something better than O(n). The second approach is O(1) (kinda) and would be ok if you had decimal numbers with a veeeeeeeeery large precision at your disposal. 1024 bits of precision is not enough for numbers with thousands of digits.
you need to find an algorithm which is better than linear complexity, and uses precise numbers thorough all calculations.
This comment is hidden because it contains spoiler information about the solution
O(log n).
i think it's good xD. so what is the good complexity ?
O(n)
time complexity is not good enough here.This comment is hidden because it contains spoiler information about the solution
Hi, My function is in o(n) and I have a time out. My language is Java.
Someone can help me ?
This comment is hidden because it contains spoiler information about the solution