Adjacent Neighbor Summation [closed]
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 8 years ago . Improve this question If I am given the numbers [1,2,1] and I want to find the sum of each number with it's adjacent neighbors (in a ring) repeated a number of times. I can use the following formula: base case: [x=1, y=2, z=1] repeat 7 times. staring with index 0 or (variable x): round 1 index 0: [(x+y+z), y, z]