标签:
int majorityElement(int* nums, int numsSize) { int times = 1; int target = nums[0]; for(int i = 1; i < numsSize; i++) { if(target == nums[i]) times++; else { times--; if(times == 0) { target = nums[++i]; times = 1; } } } return target;}标签:
原文地址:http://www.cnblogs.com/dylqt/p/5587385.html