Solving the two number sum problem efficiently

image-credit — http://clipart-library.com/
https://gist.github.com/d-beloved/77f02f17e74440edbe71592b57330585#file-numsumalgo-js
givenArray = [1, 4, 7, 5, 2, 6]
targetSum = 10
hashTable = {}
yValue = 10 - 1
yValue = 9
hashTable = {1:true, 4:true, 7:true, 5:true, 2:true}
yValue = 10 - 6
yValue = 4
https://gist.github.com/d-beloved/77f02f17e74440edbe71592b57330585#file-numsumalgo2-js
givenArray = [1, 4, 7, 5, 2, 6]
targetSum = 10
sortedArray = [1, 2, 4, 5, 6, 7]

--

--

--

Solution addict

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

#TIBFAQS Enabling Remote Debugging for TIBCO BusinessWorks Application on Kubernetes

How to Split a String Only on the First Occurrence of Delimiter ?

Salesforce Asynchronous Apex Future Method

How to Integrate firebase into Flutter app

Crontab basic commands

Upgrade Magento 2: Magento System Upgrade vs LitExtension Tool?

Exploring SharePoint Migration

Hosting a React app using S3 + CloudFront with continuous deployment using CircleCI

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Moronkeji Ayodeji

Moronkeji Ayodeji

Solution addict

More from Medium

Array Stepper Algorithm Problem

Byte size info: Stack data Structures

JavaScript: Predict the Output Questions vol. 3

Palindrome Number