How can I do this. Please help guys | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I do this. Please help guys

Let's say we have a table like this: Diana: 2 5 7 Maria: 5 6 4 Venus: 9 1 3 I need an algorithm to extract two different numbers from this table that have a SPECIFIC PRODUCT, for example 10. I want it to get me the 2 from diana and the 5 from maria. I don't want it to get the 2 and 5 from the same (string/person). Can someone give me a lead please?

10th Mar 2018, 5:29 PM
Tudor Selea
Tudor Selea - avatar
22 Answers
+ 16
@ Tudor Selea, please delete your phone number 👍😉
10th Mar 2018, 6:26 PM
tooselfish
tooselfish - avatar
+ 16
@ Tudor Selea, have a nice sunday 👍😉
10th Mar 2018, 6:48 PM
tooselfish
tooselfish - avatar
+ 7
I'd code this: Pick first person their first number that still allows getting a second one. While you haven't found the remainder, check each of the numbers of each other people. If you stll haven't found the pair, repeat the process with their next number and failing that move on to the next person. If you haven't found a working combination having check all but the last person's numbers, it doesn't exist.
10th Mar 2018, 5:58 PM
John Wells
John Wells - avatar
+ 5
Write code for your table. Write initialization of the table. Link that code here. I'll read your code and make suggestions from there (I need effort on your part because I don't write someone else's code. I will fix it even though it will take much more of my time because you will learn during the process.)
10th Mar 2018, 6:08 PM
John Wells
John Wells - avatar
+ 3
I can help you write it. But, want you to learn while doing it.
10th Mar 2018, 6:16 PM
John Wells
John Wells - avatar
+ 3
This is a safe way to direct message. https://www.sololearn.com/Discuss/689391
10th Mar 2018, 6:17 PM
John Wells
John Wells - avatar
+ 2
I'll help you.
10th Mar 2018, 6:11 PM
Timon Paßlick
+ 2
I don't know, doesn't google have an app for this? Because I don't want to post my phone number.
10th Mar 2018, 6:15 PM
Timon Paßlick
+ 2
Over 600 of SoloLearn members are on Discord.
10th Mar 2018, 6:19 PM
John Wells
John Wells - avatar
+ 2
Note that publishing personal information like skype is against the rules
10th Mar 2018, 6:21 PM
John Wells
John Wells - avatar
+ 2
@tooselfish I did. I am sorry. It won't happen again
10th Mar 2018, 6:29 PM
Tudor Selea
Tudor Selea - avatar
+ 1
I would always check everything below the current value.
10th Mar 2018, 5:57 PM
Timon Paßlick
+ 1
Skype or Discord, Tudor?
10th Mar 2018, 6:17 PM
Timon Paßlick
+ 1
Ok, we'll do Skype.
10th Mar 2018, 6:19 PM
Timon Paßlick
+ 1
Oh... Well, just delete it, I sent you a request anyways.
10th Mar 2018, 6:22 PM
Timon Paßlick
+ 1
I deleted it, I didn't remember that rule x-x
10th Mar 2018, 6:24 PM
Tudor Selea
Tudor Selea - avatar
+ 1
Are you FenOth on Discord?
10th Mar 2018, 6:24 PM
Timon Paßlick
0
@john wells. I kind of understand but I have minor knowledge in programming how do I do the stuff you said?
10th Mar 2018, 5:59 PM
Tudor Selea
Tudor Selea - avatar
0
@Timon how can we get to talk outside this app?
10th Mar 2018, 6:13 PM
Tudor Selea
Tudor Selea - avatar
0
@john okay thank you, I will try to write the code myself and hopefully I wont do many mistakes
10th Mar 2018, 6:14 PM
Tudor Selea
Tudor Selea - avatar