摘要: Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a functio 阅读全文
posted @ 2015-04-29 16:57 amazingzoe 阅读(111) 评论(0) 推荐(0)
摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target va 阅读全文
posted @ 2015-04-29 16:22 amazingzoe 阅读(120) 评论(0) 推荐(0)
摘要: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2->3-... 阅读全文
posted @ 2015-04-28 17:31 amazingzoe 阅读(100) 评论(0) 推荐(0)
摘要: Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu... 阅读全文
posted @ 2015-04-28 16:39 amazingzoe 阅读(110) 评论(0) 推荐(0)
摘要: Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ret... 阅读全文
posted @ 2015-04-28 16:31 amazingzoe 阅读(86) 评论(0) 推荐(0)
摘要: Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a... 阅读全文
posted @ 2015-04-28 10:33 amazingzoe 阅读(116) 评论(0) 推荐(0)
摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2,1,... 阅读全文
posted @ 2015-04-23 15:23 amazingzoe 阅读(90) 评论(0) 推荐(0)
摘要: Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histog... 阅读全文
posted @ 2015-04-21 20:44 amazingzoe 阅读(122) 评论(0) 推荐(0)
摘要: Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another express... 阅读全文
posted @ 2015-04-21 16:25 amazingzoe 阅读(123) 评论(0) 推荐(0)
摘要: You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文
posted @ 2015-04-20 21:07 amazingzoe 阅读(135) 评论(0) 推荐(0)