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.
Easier, yes.
Simpler, no: recursion is harder to read, understand and debug.
Faster, barely: log10(n) is only slightly faster than converting to String.
Space efficient, hard no: recursion will alocate more stack space than a string.
Personaly I prefer the solution above more, as it is easier work with(all be at slower).
I cannot see the solution since I have not solved this kata in Java, but the integer part of log10 of a positive integer + 1 is equal to the length of the decimal representation of this number:
Math.floor(Math.log10(n)+1)==n.toString().length
(more or less, sorry if this is not correct, but my Java is not fluent :) ).
can somebody explain why he used that "log10(n)" over there ?
I haven't done any math in like 2 years so I kinda forgot about logs and how they work.
Thanks a lot !
Not optimal time complexity. You iterate thru the entire listOfArt array for each value in the listOfCat array. It can be solved by iterating thru each array only once.
wtf lol
This can be done much easier without having to convert your int to a string.