You need to sign in or sign up before continuing.×
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.
Same answer as me
It's how percent decrease works. Increase in 0.82 times is equal to decrease in 0.18 times.
Not needed, in principle, and if you're speaking to genius. I made three: beforeTaxes, taxOnProfit and afterTaxes. More memory used, more lines, but much more clear. The only think I didn't see was that '1-tax' thing that I don't get yet.
So much simplier than my solution which uses a bunch of variables that were not needed.
Thanks!
Tax is a percentage value. 1%- tax means, that you will get only (100% -1%) = 99% = (1 - 0.01) = 0.99 of your return value.
Why we need to substract tax from 1?
Indeed I could, thanks for pointing this out.
You are computing complete sum for every number even if that sum already exceeds the number.
For instance n=179117, In second iteration of while loop sum=176698 so you could break it here.
As far as I know, there is no such method in Long class.
You could do String.valueOf(n).length() instead, but it's slower.
why you use custome method instead of using Long.length property from Java?
Yup, it's called a ternary operator.