26
Юлия Селиванова
Last seen 2 hours ago
Member for 10 months, 19 days
Difficulty Easy
Difficult to read, but interesting how lambda, reduce, map functions are used in one expression
More
Wonderful. One of the clearest, fastest and simplest solutions. Logic and no unnecessary lists and dictionaries. Iteration and counting. How could I not have thought of this...
More
Great! This is a new int.bit_count() for me. This is a good alternative instead str.count('1').
More
What's amazing to me is the use of a lambda function and a template argument compiled directly into an expression. If I solved this mission using re, it would take me several lines. I'll definitely take note of this method.
More
What an elegant solution! It’s difficult to immediately figure out how to use the ord function and then look for the values of the diagonal cells for the defenders among the input data. And there is no need for a chessboard in the form of an array
More
Just a cool solution, and no ord function or arrays are needed. Pure logic. Wonderful
More
I don't think this is faster than the (m^n).bit_count()solution but creative for sure
More
A good approach to use the try-except construct if the string contains only integers and you need to find the sum of only integers. If you have numbers of the float type, but you need to find the sum of only integers, then it is better to use the .isdigit() check.
More
I thought that such construction required a lambda function to access the elements of the list, i.e. filter(lambda x: x.isdigit(),list_). But you can use the default function str.isdigit and str will be the elements of list_. Great!
More