Averaging in an Infinite Array
Description:
In an infinite array with two rows, the numbers in the top row are denoted
. . . , A[−2], A[−1], A[0], A[1], A[2], . . .
and the numbers in the bottom row are denoted
. . . , B[−2], B[−1], B[0], B[1], B[2], . . .
For each integer k
, the entry A[k]
is directly above
the entry B[k]
in the array, as shown:
... | | | A[-2] | | | A[-1] | | | A[0] | | | A[1] | | | A[2] | | | ... |
... | | | B[-2] | | | B[-1] | | | B[0] | | | B[1] | | | B[2] | | | ... |
For each integer k
, A[k]
is the average of the entry to its left, the entry to its right,
and the entry below it; similarly, each entry B[k]
is the average of the entry to its
left, the entry to its right, and the entry above it.
Given A[0], A[1], A[2] and A[3]
, determine the value of A[n]
. (Where range of n is -1000<n<1000)
Test Cases are called as an array of ([A[0], A[1], A[2], A[3]], n)
Hint: Calculate B[k]
FOR JS Node v10.x -> Inputs and Outputs in BigInt!
Adapted from 2018 Euclid Mathematics Contest. https://www.cemc.uwaterloo.ca/contests/past_contests/2018/2018EuclidContest.pdf
Similar Kata:
Stats:
Created | Jul 5, 2019 |
Published | Jul 5, 2019 |
Warriors Trained | 435 |
Total Skips | 13 |
Total Code Submissions | 471 |
Total Times Completed | 74 |
JavaScript Completions | 17 |
Python Completions | 58 |
Haskell Completions | 9 |
Total Stars | 3 |
% of votes with a positive feedback rating | 91% of 34 |
Total "Very Satisfied" Votes | 30 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 7 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 3 kyu |
Lowest Assessed Rank | 8 kyu |