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.
It was genius to iterate inputs in reverse order, so checking the next sequence can be done by multiplication, which lets the algorithm not need to check if the next sequence is still integer from dividing an input with r.
And I was using one map with int[count, countOfNextSequence] as value, but it seems using two maps are clearer than my approach.
And I can't believe this is a medium level problem XD lol I'm dying.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Count Triplets
You are viewing a single comment's thread. Return to all comments →
It was genius to iterate inputs in reverse order, so checking the next sequence can be done by multiplication, which lets the algorithm not need to check if the next sequence is still integer from dividing an input with r. And I was using one map with int[count, countOfNextSequence] as value, but it seems using two maps are clearer than my approach. And I can't believe this is a medium level problem XD lol I'm dying.