# 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[], […]

## [leetcode] Remove Duplicates from Sorted Array

Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with constant memory. For example, Given input array A = […]

## [leetcode] Reverse Nodes in k-Group

Reverse Nodes in k-Group Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is. You may not alter […]