IsPalindrome
提出詳細
type Reverse<T extends string, A extends string = ""> = T extends `${infer C}${infer R}` ? Reverse<R, `${C}${A}`> : A type IsPalindrome<T extends string | number> = `${T}` extends Reverse<`${T}`> ? true : false
提出日時 | 2023-09-02 16:10:31 |
---|---|
問題 | IsPalindrome |
ユーザー | ookkoouu |
ステータス | Accepted |
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<IsPalindrome<'abc'>, false>>, Expect<Equal<IsPalindrome<'b'>, true>>, Expect<Equal<IsPalindrome<'abca'>, false>>, Expect<Equal<IsPalindrome<121>, true>>, Expect<Equal<IsPalindrome<19260817>, false>>, ]