From 527307302b63e9a5bcfc307b227e83fe52da8f8d Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Thu, 2 Nov 2023 09:49:49 +0800 Subject: [PATCH 1/2] feat: add ts solution to lc problem: No.2103 --- solution/2100-2199/2103.Rings and Rods/README.md | 9 +++++++++ solution/2100-2199/2103.Rings and Rods/README_EN.md | 9 +++++++++ 2 files changed, 18 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..f423cf6782725 100644 --- a/solution/2100-2199/2103.Rings and Rods/README.md +++ b/solution/2100-2199/2103.Rings and Rods/README.md @@ -181,6 +181,15 @@ 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..fd16ab95a682e 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,15 @@ 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 From d21c156626f4cfc15964905bb56184a9576dad78 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Thu, 2 Nov 2023 09:51:12 +0800 Subject: [PATCH 2/2] fix: format --- solution/2100-2199/2103.Rings and Rods/README.md | 3 ++- solution/2100-2199/2103.Rings and Rods/README_EN.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/solution/2100-2199/2103.Rings and Rods/README.md b/solution/2100-2199/2103.Rings and Rods/README.md index f423cf6782725..7ff5f669bdff4 100644 --- a/solution/2100-2199/2103.Rings and Rods/README.md +++ b/solution/2100-2199/2103.Rings and Rods/README.md @@ -184,8 +184,9 @@ function countPoints(rings: string): number { ```ts function countPoints(rings: string): number { let c = 0; - for (let i = 0; i <= 9; i++) + for (let i = 0; i <= 9; i++) { if (rings.includes('B' + i) && rings.includes('R' + i) && rings.includes('G' + i)) c++; + } return c; } ``` 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 fd16ab95a682e..556873e549c4c 100644 --- a/solution/2100-2199/2103.Rings and Rods/README_EN.md +++ b/solution/2100-2199/2103.Rings and Rods/README_EN.md @@ -174,8 +174,9 @@ function countPoints(rings: string): number { ```ts function countPoints(rings: string): number { let c = 0; - for (let i = 0; i <= 9; i++) + for (let i = 0; i <= 9; i++) { if (rings.includes('B' + i) && rings.includes('R' + i) && rings.includes('G' + i)) c++; + } return c; } ```