Skip to content

Commit ea31aa7

Browse files
author
wilsoncao
committed
update
1 parent 3786095 commit ea31aa7

File tree

5 files changed

+1
-1
lines changed

5 files changed

+1
-1
lines changed

.DS_Store

8 KB
Binary file not shown.

algorithms/.DS_Store

10 KB
Binary file not shown.

algorithms/cpp/.DS_Store

22 KB
Binary file not shown.
6 KB
Binary file not shown.

algorithms/cpp/majorityElement/majorityElement.II.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Solution {
3636
//the same algorithm as Majority Element I problem
3737
int majority1=0, majority2=0, cnt1=0, cnt2=0;
3838
for(auto item: nums) {
39-
if (cnt1 == 0) {
39+
if (cnt1 == 0 && majority2 != item ) {
4040
majority1 = item;
4141
cnt1 = 1;
4242
} else if (majority1 == item) {

0 commit comments

Comments
 (0)