2017年6月12日
摘要: 题目:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents ... 阅读全文
posted @ 2017-06-12 17:07 lantx 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an unsorted array of integers, find the length of longest increasing subsequence.For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The... 阅读全文
posted @ 2017-06-12 16:00 lantx 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 题目:Sort a linked list using insertion sort.思路: 使用一个指针p指向未排好序的链表的第一个结点,在排序好的部分中找到找第一个大于等于q的前驱结点,将p对应的结点插入到正确位置,p重新指向未排好序的链表的第一个结点。直到链表完成排序好。 代码... 阅读全文
posted @ 2017-06-12 15:44 lantx 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on t... 阅读全文
posted @ 2017-06-12 15:04 lantx 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 题目:Write a function to find the longest common prefix string amongst an array of strings.思路:先定最长的公共前缀为第一个字符串, 然后依次将这个与剩余的字符串作比较,得出最小的长度 即为最长公共... 阅读全文
posted @ 2017-06-12 14:31 lantx 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: “babad”Ou... 阅读全文
posted @ 2017-06-12 13:53 lantx 阅读(134) 评论(0) 推荐(0) 编辑