| about | help | code help+videos | done | prefs |
Write a method that accepts a 1-dimensional array of integers that represents a square, 2-dimensional array. The width and height of the 2-dimensional array will be "len". Your goal is to return the sum of all the elements in the array, except that all of the elements along the "main diagonal" of the array count triple.
addGrid([14], 1) → 42 addGrid([1, 7, 4, -3, -4, 9, 6, 2, 5], 3) → 31 addGrid([5], 1) → 15 ...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