EPI (Java) 3-sum problem example *can* add up to 9?

#1

Studying EPI, 2015 Java ed (ver 1.5.7). In Section 18.5 (3-sum problem) an example input array (2,3,5,7,11) is said to have no three entries adding up to 9. Repeat use of the same elements is allowed. If so, (3,3,3) does add up to 9. What am I missing?

0 Likes

#2

Hey,

Many thanks for your report, and it actually is a bug here. I have changed the wording from 9 to 22 instead.

Please keep up updated about anything you feel we should improve, and I really appreciate for your comment and suggestion.

0 Likes

#3

Also, (7,7,7) is equal to 21 as well :slight_smile:

0 Likes

#4

Hey @jgriin,

Sorry I don’t get it about your point of (7, 7, 7) here? Could you explain it more?

0 Likes

#5

Sure.

I’ve got the version 1.5.5 (of the c++ version not the java one).

On the 3-sum problem: it says that with the array [2, 3, 5, 7, 11], the only two arrays which add up to 21 are [3, 7, 11] and [5, 5, 11]. Since we can use the same entry more than once, [7, 7, 7] is a valid answer for 21 too.

0 Likes

#6

I see. Thanks for this info, and we have changed that then.

0 Likes