about | help | code help+videos | done | prefs |
apr_9_2019_APSLHL_sumPositiveModified
Write a method that returns the sum of all the positive numbers in an array of integers, except do not include a positive number if it has a negative number immediately before and after it. So do NOT include the negative numbers in the sum but also do NOT include positive numbers that are surrounded by negative numbers. You may not use any functional programming. apr_9_2019_APSLHL_sumPositiveModified([]) → 0 apr_9_2019_APSLHL_sumPositiveModified([5, 2, 1]) → 8 apr_9_2019_APSLHL_sumPositiveModified([214, 325, -5478, 953, -346, 54369, -436, 865, -532, 967, -436]) → 539 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy