Skip to content

Commit

Permalink
Added new c++ code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ks103 authored Oct 3, 2023
1 parent 5e9b016 commit a28a249
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Number of Good Pairs.c++
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Solution {
public:
int numIdenticalPairs(vector<int>& nums) {
int res=0;
for(int i=0;i<nums.size();i++){
for(int j=i+1;j<nums.size();j++){
if(nums[i]==nums[j]){
res++;
}
}
}
return res;
}
};

0 comments on commit a28a249

Please sign in to comment.