We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ec78fad commit 6ab0d4eCopy full SHA for 6ab0d4e
problem-of-the-day/March/27_minIndexOfAValidSplit.cpp
@@ -26,18 +26,18 @@ class Solution {
26
27
28
// Approach - 02
29
-
30
class Solution {
31
public:
32
int minimumIndex(vector<int>& nums) {
33
int n = nums.size();
34
35
- int majority = 0;
+ int majority = -1;
36
int count = 0;
37
38
for(int i = 0; i < n; i++){
39
if(count == 0){
40
majority = nums[i];
+ count = 1;
41
} else if(majority == nums[i]){
42
count++;
43
} else {
0 commit comments