Skip to content

Commit 9cae69f

Browse files
committedJan 2, 2025
Add solution #2621
1 parent a9e4ad8 commit 9cae69f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
 

Diff for: ‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@
364364
2618|[Check if Object Instance of Class](./2618-check-if-object-instance-of-class.js)|Medium|
365365
2619|[Array Prototype Last](./2619-array-prototype-last.js)|Easy|
366366
2620|[Counter](./2620-counter.js)|Easy|
367+
2621|[Sleep](./2621-sleep.js)|Easy|
367368
2629|[Function Composition](./2629-function-composition.js)|Easy|
368369
3392|[Count Subarrays of Length Three With a Condition](./3392-count-subarrays-of-length-three-with-a-condition.js)|Easy|
369370
3396|[Minimum Number of Operations to Make Elements in Array Distinct](./3396-minimum-number-of-operations-to-make-elements-in-array-distinct.js)|Easy|

Diff for: ‎solutions/2621-sleep.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* 2621. Sleep
3+
* https://leetcode.com/problems/sleep/
4+
* Difficulty: Easy
5+
*
6+
* Given a positive integer `ms`, write an asynchronous function that
7+
* sleeps for `ms` milliseconds. It can resolve any value.
8+
*/
9+
10+
/**
11+
* @param {number} ms
12+
* @return {Promise}
13+
*/
14+
async function sleep(ms) {
15+
return new Promise((resolve) => setTimeout(resolve, ms));
16+
}

0 commit comments

Comments
 (0)