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.
return ends a function, you would only go to the next line if it didnt return
man learning so much from just bashing my head in failure . now is_interger() has entered the chat! thank you for your knowledge
Оставшаяся часть кода после return не будет выполнятся, программа выйдет из функции, поэтому это работает без написания else
its more efficient. however you end up relying on built in functions
This comment is hidden because it contains spoiler information about the solution
It doesn't, but: "You may assume the parameter is non-negative."
return -1 is ours else
How will it work for negative integer values?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Seems like your N's is to small to see benefits from Counter. Your solution is O(n^2), so for large N, your solution will be much slower than op's solution (wich is O(n))
This doesn't work with integers that are too large to fit into a 64-bit float though.
Try
find_next_square(2**1024)
for instance.Loading more items...