Algorithm
Problem Statement for EmployManager Problem Link- https://community.topcoder.com/stat?c=problem_statement&pm=13116&rd=15852 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <bits/stdc++.h>
using namespace std;
class EmployManager {
public:
int maximumEarnings(vector<int> value, vector<string> earning) {
int total = 0;
for(int i = 0; i < value.size(); ++i)
for(int j = 0; j < value.size(); ++j)
total -= earning[i][j] - '0';
total /= 2;
for(int i = 0; i < value.size(); ++i) {
int cur = 0;
for(int j = 0; j < earning[i].size(); ++j)
cur += earning[i][j] - '0';
if(cur > value[i])
total += cur - value[i];
}
return total;
}
};
Copy The Code &
Try With Live Editor
Input
{"02", "20"}
Demonstration
TopCoder Solution SRM619-D2-1000 EmployManager C,C++, Java, Js and Python ,SRM619-D2-1000,TopCoder Solution