Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d32778c

Browse files
feat: update ts solution to lc problem: No.2337 (doocs#1499)
1 parent 566fd63 commit d32778c

File tree

1 file changed

+0
-37
lines changed
  • solution/2300-2399/2337.Move Pieces to Obtain a String

1 file changed

+0
-37
lines changed

‎solution/2300-2399/2337.Move Pieces to Obtain a String/README.md‎

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -342,43 +342,6 @@ function canChange(start: string, target: string): boolean {
342342
}
343343
```
344344

345-
### **TypeScript**
346-
347-
```ts
348-
function canChange(start: string, target: string): boolean {
349-
if (
350-
[...start].filter(c => c !== '_').join('') !==
351-
[...target].filter(c => c !== '_').join('')
352-
) {
353-
return false;
354-
}
355-
const n = start.length;
356-
let i = 0;
357-
let j = 0;
358-
while (i < n || j < n) {
359-
while (start[i] === '_') {
360-
i++;
361-
}
362-
while (target[j] === '_') {
363-
j++;
364-
}
365-
if (start[i] === 'R') {
366-
if (i > j) {
367-
return false;
368-
}
369-
}
370-
if (start[i] === 'L') {
371-
if (i < j) {
372-
return false;
373-
}
374-
}
375-
i++;
376-
j++;
377-
}
378-
return true;
379-
}
380-
```
381-
382345
```ts
383346
function canChange(start: string, target: string): boolean {
384347
const n = start.length;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /