leetcode

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

commit 9c330f567f71a6369e2fe1854e0eaa998d347d6f
parent 8615f659314ffba580cc6f0a275548e5fad50cbe
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Tue,  3 Oct 2023 23:33:50 +0000

Daily Problem

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

diff --git a/Problems/1512.cpp b/Problems/1512.cpp @@ -0,0 +1,9 @@ +class Solution { + public: + int numIdenticalPairs(const vector<int> &nums) { + int count[101] = {0}, res = 0; + for (const int n : nums) + res += count[n]++; + return res; + } +}; diff --git a/README.md b/README.md @@ -630,6 +630,7 @@ for solving problems. | 1493 | Medium | [Longest Subarray of 1's After Deleting One Element](Problems/1493.cpp) | | 1498 | Medium | [Number of Subsequences That Satisfy the Given Sum Condition](Problems/1498.cpp) | | 1502 | Easy | [Can Make Arithmetic Progression From Sequence](Problems/1502.cpp) | +| 1512 | Easy | [Number of Good Pairs](Problems/1512.cpp) | | 1514 | Medium | [Path with Maximum Probability](Problems/1514.cpp) | | 1519 | Medium | [Number of Nodes in the Sub-Tree With the Same Label](Problems/1519.cpp) | | 1523 | Easy | [Count Odd Numbers in an Interval Range](Problems/1523.cpp) |