From 8a12635bf731a2a1942a2581b4badfc978bb1191 Mon Sep 17 00:00:00 2001 From: thinkasany <117748716+thinkasany@users.noreply.github.com> Date: Thu, 2 Nov 2023 10:11:07 +0800 Subject: [PATCH] feat: add ts solution to lc problem: No.2103 (#1916) --- solution/2100-2199/2103.Rings and Rods/README.md | 10 ++++++++++ solution/2100-2199/2103.Rings and Rods/README_EN.md | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/solution/2100-2199/2103.Rings and Rods/README.md b/solution/2100-2199/2103.Rings and Rods/README.md index f330da6375382..7ff5f669bdff4 100644 --- a/solution/2100-2199/2103.Rings and Rods/README.md +++ b/solution/2100-2199/2103.Rings and Rods/README.md @@ -181,6 +181,16 @@ function countPoints(rings: string): number { } ``` +```ts +function countPoints(rings: string): number { + let c = 0; + for (let i = 0; i <= 9; i++) { + if (rings.includes('B' + i) && rings.includes('R' + i) && rings.includes('G' + i)) c++; + } + return c; +} +``` + ### **Rust** ```rust diff --git a/solution/2100-2199/2103.Rings and Rods/README_EN.md b/solution/2100-2199/2103.Rings and Rods/README_EN.md index 7cd317c3a3970..556873e549c4c 100644 --- a/solution/2100-2199/2103.Rings and Rods/README_EN.md +++ b/solution/2100-2199/2103.Rings and Rods/README_EN.md @@ -171,6 +171,16 @@ function countPoints(rings: string): number { } ``` +```ts +function countPoints(rings: string): number { + let c = 0; + for (let i = 0; i <= 9; i++) { + if (rings.includes('B' + i) && rings.includes('R' + i) && rings.includes('G' + i)) c++; + } + return c; +} +``` + ### **Rust** ```rust