![]() |
This see who the smart ones are
Question: Given an unsorted array of integers, find any 3 numbers that will add up to 100. For example, if the array has -77, 55, 22, 0, 2, and 155, one answer would be -77, 22, and 155.
|
Looks like no smart people here
|
The smart ones avoided wasting their time on something they have no need of. ;)
|
Step 1: Randomly pick 3 numbers from the array
Step 2: Do they add to 100? If Yes, DONE. If No, go to step 1. What do I win? |
Quote:
|
I gave the answer is pseudo-code. You didn't specify it needed to be in particular language. An algorithm is generally acceptable in computer science as anyone with a basic understanding of a language can easily convert it.
|
It involves numbers... I generally avoid anything involving numbers. Words are my thing. I can barely add up using a calculator :D
|
It reminds me of college exercises and Facebook Hacker Cup.
PHP Code:
|
Is it a homework question? :p
|
Quote:
|
All times are GMT. The time now is 08:43 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|