diff --git a/scripts/leetcode.js b/scripts/leetcode.js index 6389a681..d9fa8f84 100644 --- a/scripts/leetcode.js +++ b/scripts/leetcode.js @@ -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 */