Skip to content

Commit ff5cc9a

Browse files
committed
feat: update ts solution to lc problem: No.2682
1 parent 6e33368 commit ff5cc9a

File tree

4 files changed

+53
-1
lines changed

4 files changed

+53
-1
lines changed

solution/2600-2699/2682.Find the Losers of the Circular Game/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,25 @@ impl Solution {
182182
}
183183
```
184184

185+
### **TypeScript**
186+
187+
```ts
188+
function circularGameLosers(n: number, k: number): number[] {
189+
const vis = new Array(n).fill(false);
190+
const ans: number[] = [];
191+
for (let i = 0, p = 1; !vis[i]; p++) {
192+
vis[i] = true;
193+
i = (i + p * k) % n;
194+
}
195+
for (let i = 0; i < vis.length; i++) {
196+
if (!vis[i]) {
197+
ans.push(i + 1);
198+
}
199+
}
200+
return ans;
201+
}
202+
```
203+
185204
### **...**
186205

187206
```

solution/2600-2699/2682.Find the Losers of the Circular Game/README_EN.md

+19
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,25 @@ impl Solution {
163163
}
164164
```
165165

166+
### **TypeScript**
167+
168+
```ts
169+
function circularGameLosers(n: number, k: number): number[] {
170+
const vis = new Array(n).fill(false);
171+
const ans: number[] = [];
172+
for (let i = 0, p = 1; !vis[i]; p++) {
173+
vis[i] = true;
174+
i = (i + p * k) % n;
175+
}
176+
for (let i = 0; i < vis.length; i++) {
177+
if (!vis[i]) {
178+
ans.push(i + 1);
179+
}
180+
}
181+
return ans;
182+
}
183+
```
184+
166185
### **...**
167186

168187
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function circularGameLosers(n: number, k: number): number[] {
2+
const vis = new Array(n).fill(false);
3+
const ans: number[] = [];
4+
for (let i = 0, p = 1; !vis[i]; p++) {
5+
vis[i] = true;
6+
i = (i + p * k) % n;
7+
}
8+
for (let i = 0; i < vis.length; i++) {
9+
if (!vis[i]) {
10+
ans.push(i + 1);
11+
}
12+
}
13+
return ans;
14+
}

solution/util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def generate_summary(result):
203203
def refresh(result):
204204
"""update problems"""
205205
pattern = re.compile("src=\"(.*?)\"")
206-
skip_question_ids = {3, 33, 34, 375, 465, 638, 860, 983, 1511, 1555, 1565, 1599}
206+
skip_question_ids = {3, 33, 34, 375, 465, 638, 860, 983, 1511, 1555, 1565, 1599, 2682}
207207

208208
for question in result:
209209
front_question_id = question['frontend_question_id']

0 commit comments

Comments
 (0)