Created
March 7, 2025 17:21
-
-
Save EvgenyArtemov/a97ef0beb4571db01a65b7d4c6b02d84 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const timeLimit = function(fn, t) { | |
let res; | |
return async function(...args) { | |
return new Promise((res, rej) => { | |
setTimeout(() => rej("Time Limit Exceeded"), t) | |
fn(...args).then(res, rej) | |
}) | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment