Members should be able to submit the code using any for the URL containing the appropriate ID.
For example, the following URL (https:// leetcode.com/problems/unique-paths/submissions/1039832006/?envType=daily-question&envId=2023-09-03) should satisfy the submission instead of providing an error.
Refactor the following:
/**
* parseSubmissionID parses the submission ID from the submission URL.
*/
export function parseSubmissionID(submissionURLOrID: string): string {
if (LEETCODE_SUBMISSIONS_URL_PATTERN.test(submissionURLOrID)) {
return submissionURLOrID.replace(LEETCODE_SUBMISSIONS_URL_PATTERN, "")
.replace(/\/$/, "");
}
return submissionURLOrID;
}
const LEETCODE_SUBMISSIONS_URL_PATTERN =
/^https:\/\/leetcode\.com\/(problems\/.*\/submissions\/|submissions\/detail\/)/;
Note: Keep in mind if the Handbook MD must be edited
Members should be able to submit the code using any for the URL containing the appropriate ID. For example, the following URL (https:// leetcode.com/problems/unique-paths/submissions/1039832006/?envType=daily-question&envId=2023-09-03) should satisfy the submission instead of providing an error.
Refactor the following:
Note: Keep in mind if the Handbook MD must be edited