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.
Gotcha! ehehehehhe
Looks real, I believe it, thanks :3
I have a stupid question: When
n
is a constant, should we use is? ahhahahaYes, but time complexity of
sorted()
is O(n*log(n)) because behind used Timsort alg.edited or I miss understood something XD
edited 1 and it is 5 loops i think
Okey ghost watcher, thx
Now I think it's O(1) or O(3n)
edit
I'm not remember what alg used in sorted func of python
edit 1
O(1) or O(n*log(n))
Why not use? Constant values affect the speed of program execution, a program using 2 loops instead of one will run slower.
According to my tests it isn't better. Check the seraph776 fork number 2
Yes sorry O(3n) on True, not O(n^3)
Edited
Mb because of the python version, I'm using 3.9, when codewars can use 3.8, 3.10, 3.11
Where is perfomance? Mb I did something wrong, but all of my tests shows that this is slower... And this ans to return False is O(n) or O(1) alg., to return True O(n^3). My ans returns True in O(1) or O(n), False O(n)...
And yes it's faster that the code before
Little faster