/**
 * 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];
  }
}

@@ -362,8 +362,508 @@
 ;%0A  %7D%0A%7D%0A
+%0A/** solution 2%0A * A Linear Time Majority Vote Algorithm%0A * http://www.cs.utexas.edu/~moore/best-ideas/mjrty/%0A */%0Apublic class Solution %7B%0A    public int majorityElement(int%5B%5D nums) %7B%0A        int result = 0, count = 0;%0A        for(int i = 0; i %3C nums.length; i++)%7B%0A            if(count == 0) %7B%0A                result = nums%5Bi%5D;%0A                count++;%0A            %7Delse if(nums%5Bi%5D == result)%0A                count++;%0A            else%0A                count--;%0A        %7D%0A        return result;%0A    %7D%0A%7D%0A

Update 169.java