Skip to content

Commit 8263de0

Browse files
committed
Fix: Fix some mismatch title issue
1 parent fc72efa commit 8263de0

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

3108-Minimum Cost Walk in Weighted Graph/Note.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 3191. Minimum Cost Walk in Weighted Graph
1+
# 3108. Minimum Cost Walk in Weighted Graph
22

33
There is an undirected weighted graph with n vertices labeled from `0` to `n - 1`.
44

342-Power of Four/Note.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 326. Power of Four
1+
# 342. Power of Four
22

33
Given an integer `n`, return `true` if it is a power of four.
44
Otherwise, return `false`.
@@ -7,7 +7,7 @@ An integer `n` is a power of four, if there exists an integer `x` such that `n =
77

88
**Constraints:**
99

10-
- `-2^41 <= n <= 2^41 - 1`
10+
- `-2^31 <= n <= 2^31 - 1`
1111

1212
## 基礎思路
1313

scripts/verify-code-consistency.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -582,47 +582,47 @@ class CodeConsistencyVerifier {
582582

583583
/**
584584
* Parse directory name to extract problem number and title
585-
* Format: "123-Problem Title Here" -> { number: 123, title: "Problem Title Here" }
585+
* Format: "123-K-th Smallest in Lexicographical Order" -> { number: 123, title: "K-th Smallest in Lexicographical Order" }
586586
*/
587587
parseDirectoryName(dirName) {
588-
const parts = dirName.split('-');
589-
if (parts.length < 2) {
588+
const firstHyphenIndex = dirName.indexOf('-');
589+
if (firstHyphenIndex === -1) {
590590
return null;
591591
}
592-
593-
const number = parseInt(parts[0], 10);
592+
593+
const numberPart = dirName.substring(0, firstHyphenIndex).trim();
594+
const titlePart = dirName.substring(firstHyphenIndex + 1).trim();
595+
596+
const number = parseInt(numberPart, 10);
594597
if (isNaN(number)) {
595598
return null;
596599
}
597-
598-
// Join remaining parts with spaces to get the title
599-
const title = parts.slice(1).join(' ');
600-
601-
return { number, title };
600+
601+
return { number, title: titlePart };
602602
}
603603

604604
/**
605605
* Parse Note.md first line to extract problem number and title
606-
* Format: "# 123. Problem Title Here" -> { number: 123, title: "Problem Title Here" }
606+
* Format: "# 123. K-th Smallest in Lexicographical Order" -> { number: 123, title: "K-th Smallest in Lexicographical Order" }
607607
*/
608608
parseNoteTitle(firstLine) {
609609
// Remove leading # and trim
610610
const content = firstLine.replace(/^#\s*/, '').trim();
611-
611+
612612
// Split by first ". " to separate number and title
613613
const dotIndex = content.indexOf('. ');
614614
if (dotIndex === -1) {
615615
return null;
616616
}
617-
617+
618618
const numberPart = content.substring(0, dotIndex).trim();
619619
const titlePart = content.substring(dotIndex + 2).trim();
620-
620+
621621
const number = parseInt(numberPart, 10);
622622
if (isNaN(number)) {
623623
return null;
624624
}
625-
625+
626626
return { number, title: titlePart };
627627
}
628628
}

0 commit comments

Comments
 (0)