How to add arrays two digits | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to add arrays two digits

A array has [1,2,3,4,5,6,7]and we have to add two numbers in array if the results will be 8 soo print yes otherwise no by javascript

6th Oct 2020, 8:02 AM
shivam gupta
shivam gupta - avatar
14 Answers
+ 4
Please make your question clear. And also dont forget to attach a code bit which shows u have attempted this.
6th Oct 2020, 8:03 AM
Steve Sajeev
Steve Sajeev - avatar
6th Oct 2020, 8:46 AM
Steve Sajeev
Steve Sajeev - avatar
+ 2
I saw your level in js. You have to keep learning. You have reached the half way. I am saying THIS because the solution is very advanced. Because you will have to work with loops and multiple iterations.
6th Oct 2020, 8:40 AM
Steve Sajeev
Steve Sajeev - avatar
+ 2
Ok then,
6th Oct 2020, 9:01 AM
Steve Sajeev
Steve Sajeev - avatar
+ 1
Do you want to know which two numbers in an array will sum 8 please be patient it takes time.
6th Oct 2020, 8:36 AM
Steve Sajeev
Steve Sajeev - avatar
+ 1
Ok
6th Oct 2020, 8:42 AM
Steve Sajeev
Steve Sajeev - avatar
+ 1
Thanks a lot sir
6th Oct 2020, 8:49 AM
shivam gupta
shivam gupta - avatar
+ 1
I understand that very clearly
6th Oct 2020, 8:49 AM
shivam gupta
shivam gupta - avatar
+ 1
If you only need to find one pair instead of many possibilities, but in rather quick way, you might consider two-pointer approach. https://towardsdatascience.com/two-pointer-technique-solving-array-problems-at-light-speed-56a77ee83d16
6th Oct 2020, 10:12 AM
Ipang
0
I want to say that there is a array like [1,2,3,4,5,6,7,8] what we have to be for add two numbers like [7+1] soo if the results is ===8 soo code return me yes otherwise no how to Code it but we have to Code it by javascript
6th Oct 2020, 8:31 AM
shivam gupta
shivam gupta - avatar
0
What means ok sir please tell me how to Code it
6th Oct 2020, 8:34 AM
shivam gupta
shivam gupta - avatar
0
Yes sir
6th Oct 2020, 8:37 AM
shivam gupta
shivam gupta - avatar
0
And how to Code it in javascript
6th Oct 2020, 8:38 AM
shivam gupta
shivam gupta - avatar
0
Sir you only tell me the code I will understand
6th Oct 2020, 8:42 AM
shivam gupta
shivam gupta - avatar