- 博客(16)
- 资源 (5)
- 收藏
- 关注
原创 【LeetCode】82. Remove Duplicates from Sorted List II
思路很简单的一道题,思路也没什么特别的,就是设置一个prehead节点代码 ListNode* deleteDuplicates(ListNode* head) { ListNode nHead(0); ListNode* phead = &nHead; ListNode* tmp = &nHead; bool flag;
2016-05-31 20:19:58 490
原创 【LeetCode】209. Minimum Size Subarray Sum
题目Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn’t one, return 0 instead.For example, given the array [2,3,1,2,
2016-05-31 19:45:30 611
原创 【LeetCode】207. Course Schedule
题目There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pai
2016-05-30 23:40:09 1722
原创 【LeetCode】134. 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 station i to its n
2016-05-29 23:36:36 2074
原创 【LeetCode】40. Combination Sum II
题目Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the combination.
2016-05-22 22:37:24 860
原创 【LeetCode】50. Pow(x, n)
题目Implement pow(x, n).Subscribe to see which companies asked this question思路两种方法,一:一个一个乘,最多乘INT_MAX次,显然不太好。 二:每次求n/2n/2次幂,最多32次陷阱此题陷阱非常多,主要需要考虑几种特殊情况: 1. n 为 0:结果为1 2. n 为负数,需要先求再求倒数,或者直接求1/x1/x的-n次
2016-05-22 14:33:53 514
原创 【LeetCode】92. Reverse Linked List II
题目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->NULL.Note: Given m, n satisfy the following
2016-05-22 13:32:32 487
原创 【LeetCode】55. Jump Game
题目Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you a
2016-05-22 10:48:55 714
原创 【LeetCode】264. Ugly Number II
题目Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 10 ug
2016-05-21 15:06:58 653
原创 【LeetCode】234. Palindrome Linked List
题目Given a singly linked list, determine if it is a palindrome.Follow up: Could you do it in O(n) time and O(1) space?Subscribe to see which companies asked this question思路我的思路想了半天没有想出空间为1的解法,就用了最先考虑到的
2016-05-21 11:34:47 454
原创 【LeetCode】72. Edit Distance
题目Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:a)
2016-05-21 10:51:23 557
原创 【LeetCode】115. Distinct Subsequences
题目Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be none)
2016-05-17 21:16:08 561
原创 【LeetCode】95. Unique Binary Search Trees II
题目Given n, generate all structurally unique BST’s (binary search trees) that store values 1…n.For example, Given n = 3, your program should return all 5 unique BST’s shown below.思路此题最好想的思路是递归,当确定根节点是
2016-05-15 17:11:24 630
原创 【LeetCode】16. 3Sum Closest
题目Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactl
2016-05-14 16:30:21 400
原创 【LeetCode】330. Patching Array
题目Given a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in range [1, n] inclusive can be formed by the sum of some elements in the array. Ret
2016-05-14 11:59:36 665
原创 【LeetCode】290. Word Pattern
题目Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str.Examples:
2016-05-14 10:52:03 480
android口语对话系统
2014-05-10
Django1.6_利用Form实现注册登录注销修改密码
2014-03-19
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人