I think this Ruby solution underestimates the complexity required with huge numbers, although the .digits.first is clever! Using a mod 10 solution, like some of the solutions above, would greatly reduce the time/space complexity. brilliant.org/wiki/finding-the-las...
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.