You are viewing a single comment's thread. Return to all comments →
With a little more thinking got an O(n) solution, since the max possible number is only 1000. https://www.hackerrank.com/challenges/beautiful-pairs/submissions/code/23334407
Edit: improved version https://www.hackerrank.com/challenges/beautiful-pairs/submissions/code/23342269
Beautiful Pairs
You are viewing a single comment's thread. Return to all comments →
With a little more thinking got an O(n) solution, since the max possible number is only 1000. https://www.hackerrank.com/challenges/beautiful-pairs/submissions/code/23334407
Edit: improved version https://www.hackerrank.com/challenges/beautiful-pairs/submissions/code/23342269