{"id":416,"date":"2020-03-28T04:00:00","date_gmt":"2020-03-28T04:00:00","guid":{"rendered":"https:\/\/danwritescode.com\/?p=416"},"modified":"2020-06-26T05:08:21","modified_gmt":"2020-06-26T05:08:21","slug":"max-double-slice-sum-codility-100-correct-javascript-solution","status":"publish","type":"post","link":"https:\/\/danwritescode.com\/max-double-slice-sum-codility-100-correct-javascript-solution\/","title":{"rendered":"Max Double Slice Sum – Codility 100% Correct Javascript Solution"},"content":{"rendered":"\n

The Max Double Slice Sum was a challenging problem to solve in O(N) complexity.<\/p>\n\n\n\n

I iterated through the array from both sides finding out at each position the maximum sum of slices created up until that position (from the left or from the right).<\/p>\n\n\n\n

At each step I tested to see which is the maximum :<\/p>\n\n\n\n