Fibonacci Sequence
提出詳細
type Fibonacci<T extends number, C extends unknown[] = [0, 0, 0], A1 extends unknown[] = [0], A2 extends unknown[] = [0]> = T extends 1 | 2 ? 1 : C["length"] extends T ? [...A1, ...A2]["length"] : Fibonacci<T, [...C, 0], [...A1, ...A2], A1>
提出日時 | 2023-08-31 16:22:47 |
---|---|
問題 | Fibonacci Sequence |
ユーザー | ookkoouu |
ステータス | Accepted |
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<Fibonacci<3>, 2>>, Expect<Equal<Fibonacci<8>, 21>>, ]