Leetcode
文章平均质量分 79
LBY找工作
这个作者很懒,什么都没留下…
展开
-
KMP算法之Implement strStr()
Topic: Hard Mode Question: Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack. » Solve this problem 方法: 简单原创 2013-07-26 14:50:18 · 1184 阅读 · 0 评论 -
Leetcode--Reverse Linked List
Topic: Hard Mode Question: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->N原创 2013-07-27 04:06:15 · 410 阅读 · 0 评论 -
Leetcode之Search for a Range
Question: Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the targe原创 2013-08-11 02:07:39 · 330 阅读 · 0 评论 -
Leetcode&面经之Minimum Window Substring
Topic:面经 题目: leetcode上的原题是: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example, S = "ADOBECODEBANC" T原创 2013-08-15 07:02:27 · 418 阅读 · 0 评论 -
Interleaving String的解析
Interleaving String的两种面试题: 1. 给定两个String, 求出所有interleaving string的可能 2. 给定两个String,判断第三个String是不是他们的interleaving string 第一感觉必然是递归,但是two pointer和permutation的思路还是一闪而过。 Two Pointer是对的,但是permutatio原创 2013-09-13 05:59:19 · 486 阅读 · 1 评论 -
Leetcode之Gas Station
题目: There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from stat原创 2013-09-30 06:06:44 · 3810 阅读 · 1 评论 -
Leetcode之First Missing Positive
题目: Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2. Your algorithm should run in O(n) time and uses原创 2013-09-20 15:17:40 · 341 阅读 · 0 评论