See All PhotosGoogleEngaged EmployerGoogleAdd an InterviewAbout34,474Reviews3,693JobsMoreOverviewCompany OverviewOrganization StructureFAQ34,474Reviews3,693Jobs66,083Salaries16,204Interviews8,745Benefits566PhotosFollow+Add an InterviewInterview QuestionSoftware Engineer Interview-Googlethis is just a two-sum problem. given a sorted array and a number X, find all pairs whose sum is X in a efficient way.AnswerAdd TagsFlag as InappropriateFlag as InappropriateInterview Answers2 Answers▲0▼To solve this problem, you need to iterate through the array from index zero using i and another index j iterating through the subarray in the right of the current index of i.At each instance of iteration, add the element at i and at j.If the sum is X add the two pairs in the list of pairs to be returned.After exhausting the array, return the list of ordered pairs.Paul Odero - Nairobi on Nov 26, 2012Flag as InappropriateFlag as Inappropriate▲0▼i iterates from 0 to n-2; for every range[i+1,n-1], do binary search for target-num[i], if found, push to the result. remember to remove duplicate sum candidates by using continue and break statements.brady on Mar 11, 2014Flag as InappropriateFlag as InappropriateInterviews>GoogleAdd Answers or CommentsTo comment on this, Sign In or Sign Up. Google CareersWe strive to provide Googlers and their loved ones with a world-class benefits experience, focused on supporting their physical, financial,... – MoreWhere we workBuilding belongingGoogler storiesBuild your future This is the employer's chance to tell you why you should work for them. The information provided is from their perspective.