Timeline for Finding two numbers that add to a given total
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 16, 2018 at 22:06 | answer | added | Raini Kandi | timeline score: 0 | |
Oct 25, 2018 at 13:36 | answer | added | Toby Speight | timeline score: 0 | |
Jan 18, 2018 at 21:26 | answer | added | wgrampon | timeline score: 0 | |
Dec 1, 2016 at 19:30 | answer | added | Sonal Dubey | timeline score: 1 | |
Jun 17, 2015 at 5:09 | vote | accept | toy | ||
Jun 16, 2015 at 16:18 | comment | added | sunny | Agree with @twohundredping Also for any given number, you know what its pair would have to be, so you might check if performance is better to search for a specific number int he ordered list. Also once you have chosen a number, you don't have to search the entire list for its pair. Also a pair is the same whether you choose the lower or higher number first, so even for the top for loop, you should probably only search half of an ordered list. | |
Jun 15, 2015 at 19:13 | answer | added | TheBlackCat | timeline score: 3 | |
Jun 15, 2015 at 18:45 | history | edited | Jamal | CC BY-SA 3.0 |
deleted 31 characters in body; edited tags; edited title
|
Jun 15, 2015 at 18:34 | comment | added | twohundredping | Sort the numbers in ascending order (for example) and then iteratively compare the head and tail of the resulting list. There are only three options: The head is too small, the tail is too big, or they are just right ;-) | |
Jun 15, 2015 at 17:52 | history | asked | toy | CC BY-SA 3.0 |