2015年6月3日

219. Contains Duplicate II

摘要: Given an array of integers and an integerk, find out whether there there are two distinct indicesiandjin the array such thatnums[i] = nums[j]and the d... 阅读全文

posted @ 2015-06-03 04:50 shini 阅读(153) 评论(0) 推荐(0) 编辑

2015年5月29日

33. Search in Rotated Sorted Array

摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target value t... 阅读全文

posted @ 2015-05-29 08:45 shini 阅读(91) 评论(0) 推荐(0) 编辑

2015年5月28日

28. Implement strStr()

摘要: Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Update (2014-11-02):The si... 阅读全文

posted @ 2015-05-28 08:40 shini 阅读(86) 评论(0) 推荐(0) 编辑

27.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 mat... 阅读全文

posted @ 2015-05-28 08:27 shini 阅读(85) 评论(0) 推荐(0) 编辑

26. Remove Duplicates from Sorted Array

摘要: 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-05-28 08:23 shini 阅读(79) 评论(0) 推荐(0) 编辑

22. Generate Parentheses

摘要: Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文

posted @ 2015-05-28 08:12 shini 阅读(82) 评论(0) 推荐(0) 编辑

2015年5月14日

24. Swap Nodes in Pairs

摘要: Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor... 阅读全文

posted @ 2015-05-14 08:18 shini 阅读(92) 评论(0) 推荐(0) 编辑

2015年5月13日

21. Merge Two Sorted Lists

摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.经典实现题。/**... 阅读全文

posted @ 2015-05-13 08:24 shini 阅读(78) 评论(0) 推荐(0) 编辑

20. Valid Parentheses

摘要: Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ... 阅读全文

posted @ 2015-05-13 08:20 shini 阅读(122) 评论(0) 推荐(0) 编辑

19. Remove Nth Node From End of List

摘要: Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re... 阅读全文

posted @ 2015-05-13 08:09 shini 阅读(107) 评论(0) 推荐(0) 编辑

导航