MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / Solution

Class Solution

LeetCode_problems/Range addition II/solution.cpp:1–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class Solution {
2public:
3 int maxCount(int m, int n, vector<vector<int>>& ops) {
4 if(ops.size()==0)// if there is nothing in ops, then all the elements of the array will have same value, which will be the maximum value
5 return m*n;
6 int min1=ops[0][0];// storing the first value of first column
7 int min2=ops[0][1];//storing the first value of second column
8
9 for (int i = 1; i < ops.size(); i++) {
10 if(ops[i][0]<max1)
11 min1=ops[i][0];//to store the minimum value of first column
12 if(ops[i][1]<max2)
13 min2=ops[i][1];//to store the minimum value of second column
14 }
15 return max1*max2;// this will be the elements that will be covered maximum times and thus will have the maximum value
16 }
17};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected