Skip to content

Commit

Permalink
solution(cpp): Problems 1672 and 1929
Browse files Browse the repository at this point in the history
  • Loading branch information
godkingjay authored Oct 4, 2023
2 parents fb69911 + a52a4ac commit 3d03853
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Easy/1672. Richest Customer Wealth/Solution.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Solution {
public:
int maximumWealth(vector<vector<int>>& accounts) {
int max = 0;
for(int i = 0; i < accounts.size(); i++){
int sum = 0;
for(int j = 0; j < accounts[i].size(); j++){
sum += accounts[i][j];
max = max > sum ? max : sum;
}
}
return max;
}
};
15 changes: 15 additions & 0 deletions Easy/1929. Concatenation of Array/Solution.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Solution {
public:
vector<int> getConcatenation(vector<int>& nums) {
int n = nums.size();
int m = 2 * n;
vector<int> ans(m);
for(int i = 0; i < n; i++){
ans[i] = nums[i];
}
for(int i = 0; i < n; i++){
ans[n + i] = nums[i];
}
return ans;
}
};

0 comments on commit 3d03853

Please sign in to comment.