这是indexloc提供的服务,不要输入任何密码
Skip to content

2693 - EndsWith (🎥 Video Explanation and Solution) #23722

@dimitropoulos

Description

@dimitropoulos

2693 - EndsWith

EndsWith is almost identical to yesterday's challenge. So. A little break from the onslaught of other challenges never hurt anyone

🎥 Video Explanation

Release Date: 2023-02-19 19:00 UTC

EndsWith

🔢 Code

// ============= Test Cases =============
import type { Equal, Expect } from './test-utils'

type A1 = EndsWith<'abc', 'bc'>
type B1 = true
type C1 = Expect<Equal<A1, B1>>;

type A2 = EndsWith<'abc', 'abc'>
type B2 = true
type C2 = Expect<Equal<A2, B2>>;

type A3 = EndsWith<'abc', 'd'>
type B3 = false
type C3 = Expect<Equal<A3, B3>>;

// ============= Your Code Here =============
type EndsWith<
  T extends string,
  U extends string
> =
  T extends `${string}${U}`
  ? true
  : false;

➕ More Solutions

For more video solutions to other challenges: see the umbrella list! #21338

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions