Subsequence
提出詳細
type SubsequenceFromHead<T> = T extends [infer Head, ...infer Tail] ? [] | [Head, ...Subsequance<Tail>] : never type Subsequence<T> = T extends [Head, ...infer Tail] ? SubsequenceFromHead<T> | Subsequence<Tail>
提出日時 | 2022-06-24 02:36:43 |
---|---|
問題 | Subsequence |
ユーザー | cisdur |
ステータス | Wrong Answer |
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<Subsequence<[1, 2]>, [] | [1] | [2] | [1, 2]>>, Expect<Equal<Subsequence<[1, 2, 3]>, [] | [1] | [2] | [1, 2] | [3] | [1, 3] | [2, 3] | [1, 2, 3] >>, ]