Cody

Dave Walter

8122
Rank
2
Badges
190
Score
1 – 24 of 24

Dave Walter submitted Solution 742968 to Problem 167. Pizza!

on 22 Sep 2015

Dave Walter submitted a Comment to Solution 607682

Why are you incrementing the solution with i=i+1? The for loop automatically increments from 1 to n-1. You are also only really testing the last two values in the vector. Your function returns false for each pair in vector but overwrites tf = false with true when it reaches the last two entries. You need to break out of the loop if you detect one false.

on 22 Sep 2015

Dave Walter received Commenter badge for Solution 607682

on 22 Sep 2015

Dave Walter submitted a Comment to Solution 607682

You fail test 2, since the vector x has length 1, you never evaluate anything in your loop. This can be fixed by initializing tf before the loop. Look into recursive solution instead of this loop.

on 22 Sep 2015

Dave Walter received Solver badge for Solution 393888

on 30 Jan 2014

1 – 24 of 24