摘要:
题目:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents ... 阅读全文
摘要:
题目: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... 阅读全文
摘要:
题目:Sort a linked list using insertion sort.思路: 使用一个指针p指向未排好序的链表的第一个结点,在排序好的部分中找到找第一个大于等于q的前驱结点,将p对应的结点插入到正确位置,p重新指向未排好序的链表的第一个结点。直到链表完成排序好。 代码... 阅读全文
摘要:
题目:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on t... 阅读全文
摘要:
题目:Write a function to find the longest common prefix string amongst an array of strings.思路:先定最长的公共前缀为第一个字符串, 然后依次将这个与剩余的字符串作比较,得出最小的长度 即为最长公共... 阅读全文
摘要:
题目: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... 阅读全文