2026-05-02 19:17:46 +09:00

10 lines
309 B
TypeScript

function solution(common: number[]) {
let [a, b, c]: number[] = [common[0], common[1], common[2]];
let len: number = common.length;
if(a + c === 2 * b) return common[len - 1] + (b - a);
else return common[len - 1] * (b / a);
}
let common: number[] = [1,2,3,4];
console.log(solution(common));