## Remove Element

Given an array and a value, remove all instances of that value in place and return the new length.

The order of elements can be changed. It doesn’t matter what you leave beyond the new length. code:

 ``````1 2 3 4 5 6 7 8 9 `````` ``````int removeElement(int* nums, int numsSize, int val) { int i,j; i=-1; for(j=0;j0) if(nums[j]!=val) nums[++i]=nums[j]; return i+1; }``````

## Single Number

Given an array of integers, every element appears twice except for one. Find that single one.

 ``````1 2 3 4 5 6 `````` ``````int singleNumber(int* nums, int numsSize) { int single=0; for(int i=0;i

## Single Number II

Given an array of integers, every element appears three times except for one. Find that single one.

 `````` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 `````` ``````int singleNumber(int* nums, int numsSize) { int sum; int i,j; int single=0; for(i=0;i<32;i++) sum[i]=0; for(i=0;i>j &1); for(j=0;j<32;j++) if(sum[j]%3) single|= 1<

## Majority Elements

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.

 `````` 1 2 3 4 5 6 7 8 9 10 `````` ``````int majorityElement(int* nums, int numsSize) { int major,i,num=0; for (i=0;i