Skip to content

Commit

Permalink
Added leading zeros to titles
Browse files Browse the repository at this point in the history
  • Loading branch information
benlowenthal authored Sep 7, 2022
1 parent a36191a commit 15320ac
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/leetcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,15 @@ function getProblemNameSlug() {
questionTitle = qtitle[0].innerText;
}
}
return convertToSlug(questionTitle);
return addLeadingZeros(convertToSlug(questionTitle));
}

function addLeadingZeros(title) {
var len = title.split('-')[0].length;
if (len < 4) {
return '0'.repeat(4 - len) + title;
}
return title;
}

/* Parser function for the question and tags */
Expand Down

0 comments on commit 15320ac

Please sign in to comment.