- 博客(6)
- 收藏
- 关注
原创 leetcode 14, 38, 345
14. Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.这道题思路比较直观,实现也比较简单。题目要从一堆字符串中找出所有字符串的公共最长前缀。要找出所有字符串的公共最长前缀,那么我们可以先找出前两个字符串的公共最长
2017-06-07 22:30:43
213
原创 leetcode169 229
169. Majority ElementGiven 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-empt
2017-06-01 15:49:10
219
原创 leetcode 26, 27, 283
leetcode 26Given 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 t
2017-05-24 22:30:39
220
原创 leetcode 268r
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2.Note:Your algorithm sho
2017-05-21 15:53:22
156
原创 leetcode 19 和leetcode 83
19. Remove Nth Node From End of List问题描述:Given a linked list, remove the nth node from the end of list and return its head.题目规定了你可以认为n总是有效的,并尽可能只遍历链表一次就完成操作。分析时首先可以想到的基本思路是找到倒数第n个节点然后删
2016-08-30 19:08:20
239
原创 leetcode 237和leetcode 206
237. Delete Node in a Linked List。Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and
2016-08-29 14:24:10
347
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人