Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IsPalindrome #4037

Closed
jiangshanmeta opened this issue Oct 20, 2021 · 2 comments · Fixed by #4038
Closed

IsPalindrome #4037

jiangshanmeta opened this issue Oct 20, 2021 · 2 comments · Fixed by #4038
Labels
new-challenge Propose a new challenge, a PR will be auto generated

Comments

@jiangshanmeta
Copy link
Member

Please follow the template and fill the info. A PR will be auto-generated and always reflect on your changes.

Detailed solution/guide is not required, but please be sure the challenge is solvable.

Info

Basic info of your challenge questions,

difficulty: hard
title: IsPalindrome
tags: string

Question

Implement type IsPalindrome<T> to check whether a string or number is palindrome.

For example:

IsPalindrome<'abc'> // false
IsPalindrome<121> // true

Template

This is the template for challengers to start the coding. Basically, you just need to change the name of your generic/function and leave to implementation any.

type IsPalindrome<T> = any

Test Cases

Provide some test cases for your challenge, you can use some utils from @type-challenges/utils for asserting.

import { Equal, Expect, ExpectFalse, NotEqual } 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>>,
]
@jiangshanmeta jiangshanmeta added the new-challenge Propose a new challenge, a PR will be auto generated label Oct 20, 2021
github-actions bot pushed a commit that referenced this issue Oct 20, 2021
@github-actions
Copy link
Contributor

#4038 - Pull Request updated.

2021-10-20T07:42:28.898Z Preview in Playground

antfu pushed a commit that referenced this issue Oct 20, 2021
Co-authored-by: jiangshan <13798212+jiangshanmeta@users.noreply.github.com>
@orta
Copy link
Contributor

orta commented Oct 22, 2021

haha, what a great idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-challenge Propose a new challenge, a PR will be auto generated
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants