Daily Archives: February 26, 2015


[leetcode] Divide Two Integers

Divide Two Integers Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. tags: math, binary search 8/10/2015 update Reference http://yucoding.blogspot.com/2013/01/leetcode-question-28-divide-two-integers.html class Solution { public: int divide(int dividend, int divisor) { int flag = 1; long ldividend = dividend; long ldivisor = divisor; if(ldividend […]


[leetcode] Remove Element

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. 简单题,与上一题Remove Element in Sorted Array类似 class Solution { public: int removeElement(int A[], […]