- 博客(41)
- 收藏
- 关注
原创 期末作业8.3
题目:STINGY SAT is the following problem: given a set of clauses(each a disjunction of literals) ans an integer k, find a satisfying assignment in which at most k variables are true, if such an assignmen
2017-07-13 10:19:21
298
1
原创 241. Different Ways to Add Parentheses
241. Different Ways to Add Parentheses题目:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid op
2017-07-13 00:10:17
219
原创 72. Edit Distance
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 permi
2017-06-28 22:12:30
185
原创 200. Number of Islands
200. Number of Islands题目:Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or ve
2017-06-28 21:33:16
231
原创 221. Maximal Square
221. Maximal Square题目:Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.For example :given the following matrix:1 0 1 0 01 0 1 1 11 1
2017-06-28 21:06:02
158
原创 376. Wiggle Subsequence
376. Wiggle Subsequence题目:A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one
2017-06-28 17:47:55
208
原创 338. Counting Bits
338. Counting Bits题目:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example
2017-06-28 17:06:23
172
原创 96. Unique Binary Search Trees
96. Unique Binary Search Trees题目:Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example :Given n = 3, there are a total of 5 unique BST's. 1 3
2017-06-27 11:31:24
222
原创 322. Coin Change
322. Coin Change题目:You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If tha
2017-06-27 11:21:38
194
原创 211. Add and Search Word - Data structure design
211. Add and Search Word - Data structure design题目:Design a data structure that supports the following two operations:void addWord(word)bool search(word)search(word) can search a literal word or a re
2017-06-25 23:11:20
197
原创 78. Subsets 解法二
78. Subsets题目:Given a set of distinct integers, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example :If nums = [1,2,3], a solution is:[ [3], [1],
2017-06-22 23:28:46
243
原创 Combination
Combination题目:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example :If n = 4 and k = 2, a solution is:[[2,4],[3,4],[2,3],[1,2],[1,3],[1,4],]代码如下:
2017-06-22 23:25:24
355
原创 78. Subsets
78. Subsets题目:Given a set of distinct integers, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example :If nums = [1,2,3], a solution is:[ [3], [1],
2017-06-22 22:22:47
230
原创 39. Combination Sum
39. Combination Sum题目:Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number
2017-06-22 21:22:19
164
原创 63. Unique Paths II
63. Unique Paths II题目:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectiv
2017-06-22 20:51:28
160
原创 62. Unique Paths
62. Unique Paths题目:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying
2017-06-22 09:37:01
153
原创 53. Maximum Subarray
53. Maximum Subarray题目:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subar
2017-06-22 08:37:47
212
原创 198. House Robber 解法二
198. House Robber题目:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is
2017-06-21 21:03:07
226
原创 134. Gas Station
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 s
2017-06-21 20:55:05
247
原创 55. Jump Game
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.Dete
2017-06-21 19:52:55
180
原创 120. Triangle
120. Triangle题目:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,
2017-06-21 19:35:59
146
原创 213. House Robber II
213. House Robber II题目:After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all houses at this plac
2017-06-20 21:20:50
122
原创 198. House Robber
198. House Robber题目:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is
2017-06-20 19:45:57
201
原创 121. Best Time to Buy and Sell Stock
121. Best Time to Buy and Sell Stock题目:Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy on
2017-06-20 19:20:16
150
原创 100. Same Tree
100. Same Tree题目:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.代码
2017-06-20 19:03:40
142
原创 70. Climbing Stairs
70. Climbing Stairs题目:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n w
2017-06-20 16:54:40
249
原创 35. Search Insert Position
题目:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.He
2017-06-20 16:00:32
158
原创 21. Merge Two Sorted Lists
题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.代码如下:class Solution {public: ListNode* mergeTwoLists
2017-06-20 15:34:01
126
原创 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.For example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the linked lis
2017-06-20 14:58:49
152
原创 486. Predict the Winner
题目:Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks
2017-06-13 16:41:33
196
原创 530. Minimum Absolute Difference in BST
Minimum Absolute Difference in BST题目:Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes.Example:Input: 1 \ 3 / 2
2017-05-22 23:30:33
175
原创 Easy : 122. Best Time to Buy and Sell Stock II
Best Time to Buy and Sell Stock II题目:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many tran
2017-05-09 11:42:15
189
原创 Medium:Find Bottom Left Tree Value
513. Find Bottom Left Tree Value题目:Given a binary tree, find the leftmost value in the last row of the tree.Example 1:Input: 2 / \ 1 3Output:1Example 2: Input: 1 / \
2017-05-02 20:11:47
323
原创 Medium:Find Largest Value in Each Tree Row
515. Find Largest Value in Each Tree RowYou need to find the largest value in each row of a binary tree.Example:Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [
2017-05-02 19:28:27
322
原创 Medium: Binary Tree Paths Add to List
257. Binary Tree Paths Add to ListDescriptionHintsSubmissionsSolutionsTotal Accepted: 102130Total Submissions: 276990Difficulty: EasyContributor: LeetCodeGiven a binary tree, return all root-to-l
2017-04-24 23:42:22
193
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人