about | help | code help+videos | done | prefs |
patternedArray
First, solve https://codingbat.com/prob/p279839 Define a function that when passed three integers (say a, b, n), returns an array in an arithmetic progression such that it contains n items, the first (if any) being a, the second (if any) being b. The subsequent items can be worked out from the information provided. Return an empty array if n <= 0. patternedArray(1, 2, 0) → [] patternedArray(1, 2, -1) → [] patternedArray(2, 4, 5) → [2, 4, 6, 8, 10] ...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: 4 Post-solution available
Copyright Nick Parlante 2017 - privacy