@@ -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