I like how this kata calls 0 and negative numbers "a power of two" ;)
It is still possible to cheat. Increase the number of tests especially for big numbers as i've just typed : if(n > 100000) return 2 and that was it.
Can you give details of how this works?
I thought this solution was nice and neat but when I try to run it in Jupyter, it doesn't perform as expected. I get 'Beautiful is better than ugly.\nExplicit is better than implicit.\nSimple is better than complex.\nComplex is better than complicated.' I copy and pasted the above code so why doesn't the "\n" actually print a new line? I've run into this issue before (I'm still a newb) where I've tried to use "\n" and instead of it printing a new line, it prints \n within the string. Can anyone explain why this is occurring?
Thanks for any insight!
There are random tests.
I had to "bypass" this problem in the random tests (JS) as well. Otherwise, nice one ;)
would and should;-)... l and r are global values, so should be never best practice...
This would fail if there were any characters other than "?" or "!" in the string. And double equals should never be best practice.
$radius * $radius is equals to short notation: $radius ** 2 :)
This is not best practice at all. You are iterating trough the entire string even if you already find the answer. For example if you have only 1 '!' in your left param and 1 milion '?' in your right param, your function will run and sum all of the 1 million '?' from your right param even though it should stop after checking the first 2 elements.
Thanks for your good katas (as always);-).
I reduced my time here (more time for ML/KI/Deep Learning a.s.o.), so i only solved less katas, but last days some others of yours too;-)...
Thanks for your good work.
wouldnt you jsut have two numbers if you used Set to make unqiues?
Yes, why not:-)... i remembered your solution and was waiting for your comment...;-)