It seems this kata actually requires finding those prime factors which is a (very) hard problem in general. I'm not sure whether non-sophisticated approaches will work here (that depends on the size of the input numbers), so I will skip this kata for now.
Great stuff, love it! Contains some nice hidden details such as using operator< on std::pair<>, C++14 lambda captures with initializer, etc. that make the solution very dense.
Greatest drawback, in my opinion, is that it doesn't work for empty lists of intervals where it does invoke UB (because of intervals[0]). I fixed that in a fork, and additionally improved readability a bit more by using some other modern C++ features.
Your wish is granted
The std::exchange + ternary made it perfect. Nice work!
It seems this kata actually requires finding those prime factors which is a (very) hard problem in general. I'm not sure whether non-sophisticated approaches will work here (that depends on the size of the input numbers), so I will skip this kata for now.
Great stuff, love it! Contains some nice hidden details such as using
operator<
onstd::pair<>
, C++14 lambda captures with initializer, etc. that make the solution very dense.Greatest drawback, in my opinion, is that it doesn't work for empty lists of intervals where it does invoke UB (because of
intervals[0]
). I fixed that in a fork, and additionally improved readability a bit more by using some other modern C++ features.This kata has been much more fun than I initially thought it would!
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
Dope!
This comment is hidden because it contains spoiler information about the solution
Lol
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
Slow but nice and simple.
Loading more items...