Because its iterate through an array twice.On first iteration it square each number, on second iteration it sums all numbers.
Anyway this solution is still valid and very easy to read so its good for me.Cheers!
are you seven?
If you are still active and are getting notifications, would you mind telling me why you think this is bad? Thank you :)
He's a level 3 kyu so maybe he was just having fun with it? I know that seems shocking but people have fun with codewars.
This comment is hidden because it contains spoiler information about the solution
This is fucking stupid.
Agreed... this is a really boring kata. Bottom 2% probably
You should return, not print.
Nobody's argued about the ranking except you. And there's a lot shorter, O(1) solution which works for any possible and impossible ages of the father and son, so it's your mistake overcomplicating the task.
Fixed it. Thank you.
Java. The age generation is wrong. In the random tests:
int dad = rand.nextInt(82)+18;
int son = dad - rand.nextInt(22)+18; <-- this line should be int son = dad - (rand.nextInt(22) + 18);
What is the programming language?