/**
 * Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. 
 * You may assume that the array is non-empty and the majority element always exist in the array.
 */
public class Solution {
  public int majorityElement(int[] nums) {
      Arrays.sort(nums);
      return nums[nums.length/2];
  }
}

/** solution 2
 * A Linear Time Majority Vote Algorithm
 * http://www.cs.utexas.edu/~moore/best-ideas/mjrty/
 */
public class Solution {
    public int majorityElement(int[] nums) {
        int result = 0, count = 0;
        for(int i = 0; i < nums.length; i++){
            if(count == 0) {
                result = nums[i];
                count++;
            }else if(nums[i] == result)
                count++;
            else
                count--;
        }
        return result;
    }
}

@@ -601,34 +601,14 @@
 nt i
- = 0; i %3C nums.length; i++
+: nums
 )%7B%0A 
@@ -660,23 +660,17 @@
 esult = 
-nums%5Bi%5D
+i
 ;%0A      
@@ -713,15 +713,9 @@
  if(
-nums%5Bi%5D
+i
  == 

Update 169.java