Skip to content

Commit 6ab0d4e

Browse files
Day 27 : Minimum index of a valid split
1 parent ec78fad commit 6ab0d4e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

problem-of-the-day/March/27_minIndexOfAValidSplit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ class Solution {
2626

2727

2828
// Approach - 02
29-
3029
class Solution {
3130
public:
3231
int minimumIndex(vector<int>& nums) {
3332
int n = nums.size();
3433

35-
int majority = 0;
34+
int majority = -1;
3635
int count = 0;
3736

3837
for(int i = 0; i < n; i++){
3938
if(count == 0){
4039
majority = nums[i];
40+
count = 1;
4141
} else if(majority == nums[i]){
4242
count++;
4343
} else {

0 commit comments

Comments
 (0)