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.
Actually on this site i seeing many people who kinda like to explain their code. Thats why i asked this question, and ofc playing with code and trying to figure out how it work before write comment.
Why exactly if
len(s)
is odd then negative index slicings[-mid]
return substring witouht first number?I guess this operation with negative-index slicing making algorithm much more elegant and clearful, and allow you to rid of multiple
if .. else
blocks. But i still cant find out how it works.This comment is hidden because it contains spoiler information about the solution
groupby()
take iterable(sort of sequence) and return tuple of group key(str) and lazy iterator(itertols._grouper).So because its lazy it will give you a value only as in needed. But you can get sum of iterators values.
Then you need to create generator expression, which consist of
Hope i did it good.
I was little confusing about this case too :)
Although, this is good practice for data validation
IMHO 6 kyu kata. Pretty intresting, as for me
I dont get it: How is it possible to palindromize 750? reversed is 057.
I think this solution not so optimal at the point of memory managment. Using copy for new str is resourcefull operation that allocate new memory for new obj.
Better one is consistant comparison, when we compare letter from end and from start of input string.
.lower()
method for valid compare. Only counting indenfier increase and decrease. So, if we have different letters - loop is over.You're right and wrong at the same time. Codewars not only about algorithm training, its about finding more efficient solution too.
Anyway, its cool, when u able to implement logic/algorithm of built-in function, and this able itself give you understanding of inner logic of those functions
This comment is hidden because it contains spoiler information about the solution
Damn, i wrote my solution almost 6 hours :D
Regex is powerful instrument, if u know how to use it. Anyway, i've tried
This comment is hidden because it contains spoiler information about the solution
Nice kata, but i think need more details. In description nothing said about digit 1 and symbols * and # implementation. In JavaScript tests digit 1 implementation is necessary and symbols don't. Although symbols not necessary some guys implement it.
Nice solution, using replace arrow function ability
More elegant than my solution. I don't remember that for loop can set two variable in first statement, so I add variable above
Loading more items...