Subset Sum Scoreboard
Rank Username Score
1 primo 1000 (101 B)
2 vird 802 (126 B)
3 Steinigtmich 795 (127 B)
4 eremit 721 (140 B)
5 Ock 706 (143 B)
6 jt2k 706 (143 B)
7 scottholdren 678 (149 B)
8 linepogl 643 (157 B)
9 svendra 577 (175 B)
10 nishanth 432 (234 B)
11 ricodimas 311 (325 B)
12 anneliesez 70 (1441 B)
Recent Activity
Username Bytes Time ago Result
vird 126 March 03 2013, 18:26:06
vird 131 February 21 2013, 02:12:18
linepogl 157 January 24 2013, 11:38:11
linepogl 157 January 24 2013, 11:38:07
linepogl 157 January 24 2013, 11:37:55
nishanth 234 December 12 2012, 07:26:21
nishanth 236 December 11 2012, 13:09:31
nishanth 252 December 11 2012, 13:02:33
nishanth 262 December 11 2012, 12:53:56
nishanth 262 December 11 2012, 12:50:59
nishanth 364 December 11 2012, 12:11:08
nishanth 378 December 11 2012, 12:04:13
svendra 175 October 12 2012, 17:16:51
svendra 180 October 12 2012, 16:46:55
svendra 181 October 12 2012, 16:43:13

Challenge: Subset Sum

Challenge information

Challenge Type Private
Challenge Status Open
Constant name LISTS
Trim method Full trim
Disabled functions shuffle str_shuffle
Rating [ up ] [ down ]

Instructions

The input is 20 lists of numbers separated with a newline.

Each list will contain numbers from -20 to 20 without 0.

Each number in the list will be separated with a comma.

Find out if any combination of the numbers in the list will add up to 0.

Print out "yes" or "no" for each list.

The output for the list 10,-20,10,5,-9 should be "yes" because 10 + 10 + (-20) equals 0.

Read more here: http://en.wikipedia.org/wiki/Subset_sum_problem

Example

Show/hide Input
10,-20,10,5,-9
18,-19,-2,-9,9
7,-9,-4,-5,-6
6,6,-19,-2,-12
-17,8,-3,-8,13
-9,-14,-8,-11,-6
-13,-7,3,-16,-3
1,17,-11,7,-1
-11,-12,14,19,-15
10,8,-9,-17,8
-4,5,5,-14,-15
-9,-9,-16,-3,13
17,-4,-4,20,-16
-1,-16,2,4,19
12,4,11,5,10
-7,-14,-13,5,-15
-3,4,-18,12,-2
-20,9,8,-11,-8
-18,8,-12,-18,-19
-15,-2,-12,-17,13
Show/hide Output
yes
yes
no
yes
yes
no
yes
yes
no
yes
no
no
yes
no
no
no
no
yes
no
no

Comments

Show/hide comments (0)