leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

commit 45df212fd6301559bf6b382e0ef3c571de5bb783
parent 558e36c9f9d0621987c3d3f94581c73f7234b0dc
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Sun, 10 Sep 2023 17:30:41 +0200

Daily Problem

Diffstat:
AProblems/1359.cpp | 9+++++++++
MREADME.md | 1+
2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/Problems/1359.cpp b/Problems/1359.cpp @@ -0,0 +1,9 @@ +class Solution { + public: + int countOrders(const int n) { + long res = 1, mod = (long)1E9 + 7; + for (int i = 1; i <= n; i++) + res = res * (i * 2 - 1) * i % mod; + return res; + } +}; diff --git a/README.md b/README.md @@ -532,6 +532,7 @@ for solving problems. | 1347 | Medium | [Minimum Number of Steps to Make Two Strings Anagram](Problems/1347.cpp) | | 1351 | Easy | [Count Negative Numbers in a Sorted Matrix](Problems/1351.cpp) | | 1357 | Medium | [Apply Discount Every n Orders](Problems/1357.cpp) | +| 1359 | Hard | [Count All Valid Pickup and Delivery Options](Problems/1359.cpp) | | 1361 | Medium | [Validate Binary Tree Nodes](Problems/1361.cpp) | | 1367 | Medium | [Linked List in Binary Tree ](Problems/1367.cpp) | | 1372 | Medium | [Longest ZigZag Path in a Binary Tree](Problems/1372.cpp) |