We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This is the approach I wanted, mainly for the elegence in the expression. Unfortunately its too slow for my beloved Ruby! Lucky you Python people can blaze through that same one liner and still pass. I tried the two-pointer approach as described by @agoston_fung and its fast enough to pass with Ruby ;-)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Pairs
You are viewing a single comment's thread. Return to all comments →
This is the approach I wanted, mainly for the elegence in the expression. Unfortunately its too slow for my beloved Ruby! Lucky you Python people can blaze through that same one liner and still pass. I tried the two-pointer approach as described by @agoston_fung and its fast enough to pass with Ruby ;-)