Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 15239ff

Browse files
committed
Add solution #2723
1 parent f997462 commit 15239ff

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

2723-add-two-promises.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* 2723. Add Two Promises
3+
* https://leetcode.com/problems/add-two-promises/
4+
* Difficulty: Easy
5+
*
6+
* Given two promises promise1 and promise2, return a new promise. promise1 and promise2
7+
* will both resolve with a number. The returned promise should resolve with the sum of
8+
* the two numbers.
9+
*/
10+
11+
/**
12+
* @param {Promise} promise1
13+
* @param {Promise} promise2
14+
* @return {Promise}
15+
*/
16+
var addTwoPromises = async function(promise1, promise2) {
17+
return Promise.all([promise1, promise2]).then(([a, b]) => a + b);
18+
};

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@
440440
2715|[Timeout Cancellation](./2715-timeout-cancellation.js)|Easy|
441441
2721|[Execute Asynchronous Functions in Parallel](./2721-execute-asynchronous-functions-in-parallel.js)|Medium|
442442
2722|[Join Two Arrays by ID](./2722-join-two-arrays-by-id.js)|Medium|
443+
2723|[Add Two Promises](./2723-add-two-promises.js)|Easy|
443444
2724|[Sort By](./2724-sort-by.js)|Easy|
444445
3042|[Count Prefix and Suffix Pairs I](./3042-count-prefix-and-suffix-pairs-i.js)|Easy|
445446
3110|[Score of a String](./3110-score-of-a-string.js)|Easy|

0 commit comments

Comments
 (0)