This is extremely simple problem where-in we traverse the array starting from 0’th index ( and incrementing by one index at a time ) and search for the reminder of the targetSum in rest of the array. Code can be found @ Two Sum – LeetCode. This is an O(n^2) algorithm. We can solve this…