- 博客(28)
- 收藏
- 关注
原创 LeetCode 494. Target Sum
原题:https://leetcode.com/problems/target-sum/description/题目描述: You are given a list of non-negative integers, a1, a2, …, an, and a target, S. Now you have 2 symbols + and -. For each integer, you ...
2018-02-26 23:33:38 114
原创 LeetCode160. Intersection of Two Linked Lists
原题地址:https://leetcode.com/problems/intersection-of-two-linked-lists/description/题目描述: Write a program to find the node at which the intersection of two singly linked lists begins.For example, t...
2018-02-24 20:45:17 106
原创 LeetCode142. Linked List Cycle II
原题地址:https://leetcode.com/problems/linked-list-cycle-ii/description/题目描述: Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the ...
2018-02-24 20:35:47 140
原创 LeetCode141. Linked List Cycle
原题地址:https://leetcode.com/problems/linked-list-cycle/description/题目描述: Given a linked list, determine if it has a cycle in it.Follow up: Can you solve it without using extra space?题解:判断一个单...
2018-02-24 20:23:16 112
原创 8.3证明吝啬SAT问题是NP-Complete问题
SAT问题:一个CNF由若干个字句组成,每个字句由逻辑或连接起来,每个文字是一个布尔变量或其否定。是否存在一个所有变量为真的真值指派(使所有字句为真的每个布尔变量的取值)。 吝啬SAT问题:一个CNF由若干个字句组成,每个字句由逻辑或连接起来,每个文字是一个布尔变量或其否定。是否存在一个至多K个变量为真的指派(使至多K字句为真的每个布尔变量的取值)。1.若已知某个真值集合,很容易看出在多
2017-12-27 22:32:26 423
原创 LetCode368. Largest Divisible Subset
https://leetcode.com/problems/largest-divisible-subset/description/Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies:
2017-12-26 20:10:07 126
原创 LeetCode670. Maximum Swap
原题:https://leetcode.com/problems/maximum-swap/description/Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you cou
2017-12-19 22:28:43 212
原创 LeetCode724. Find Pivot Index
原题:https://leetcode.com/problems/find-pivot-index/description/Given an array of integers nums, write a method that returns the “pivot” index of this array.We define the pivot index as the index where t
2017-12-17 18:13:24 142
原创 LeetCode 692. Top K Frequent Words
https://leetcode.com/problems/top-k-frequent-words/description/Given a non-empty list of words, return the k most frequent elements.Your answer should be sorted by frequency from highest to lowest. If
2017-12-07 20:27:13 199
原创 LeetCode122. Best Time to Buy and Sell Stock II
原题:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/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 ma
2017-11-30 17:20:29 166
原创 LeetCode121. Best Time to Buy and Sell Stock
原题:https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/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 complet
2017-11-30 16:59:05 118
原创 LeetCode394. Decode String
原题:https://leetcode.com/problems/decode-string/description/Given an encoded string, return it’s decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square bracke
2017-11-24 15:09:24 146
原创 LeetCode Add to List 632. Smallest Range
原题:https://leetcode.com/problems/smallest-range/description/You have k lists of sorted integers in ascending order. Find the smallest range that includes at least one number from each of the k lists.We
2017-11-19 16:22:06 189
原创 LeetCode20. Valid Parentheses
原题:https://leetcode.com/problems/valid-parentheses/description/Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must cl
2017-11-07 14:10:39 119
原创 LeetCode718. Maximum Length of Repeated Subarray(Medium)
原题:https://leetcode.com/problems/maximum-length-of-repeated-subarray/description/Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.Example 1: Inpu
2017-11-02 20:09:55 135
原创 LeetCode714. Best Time to Buy and Sell Stock with Transaction Fee
原题:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/description/题目: Your are given an array of integers prices, for which the i-th element is the price of a given sto
2017-10-27 15:00:59 194
原创 LeetCode392. Is Subsequence(Medium)
原题:https://leetcode.com/problems/is-subsequence/description/Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t.
2017-10-23 13:23:23 176
原创 LeetCode650. 2 Keys Keyboard
原题:https://leetcode.com/problems/2-keys-keyboard/discuss/题目: Initially on a notepad only one character ‘A’ is present. You can perform two operations on this notepad for each step:Copy All: You can co
2017-10-16 14:27:38 234
原创 LeetCode1. Two Sum
原题:https://leetcode.com/problems/two-sum/description/Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have e
2017-10-08 16:45:30 160
原创 LeetCode513. Find Bottom Left Tree Value
原题:https://leetcode.com/problems/find-bottom-left-tree-value/description/题目描述: Given a binary tree, find the leftmost value in the last row of the tree.Example 1:Input: 2 / \ 1 3Output:1Exa
2017-10-01 21:37:33 145
原创 LeetCode113. Path Sum II(Medium)
原题:https://leetcode.com/problems/path-sum-ii/description/题目描述: Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.For example: Given the below binar
2017-09-24 11:32:37 152
原创 LeetCode112. Path Sum(Easy)
原题地址:https://leetcode.com/problems/path-sum/description/题目描述: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the
2017-09-20 20:52:38 192
原创 LeetCode493. Reverse Pairs(Hard)
原题地址:https://leetcode.com/problems/reverse-pairs/description/题目: Given an array nums, we call (i, j) an important reverse pair if i < j and nums[i] > 2*nums[j].You need to return the number of importa
2017-09-18 13:59:00 394
原创 LeetCode53. Maximum Subarray(easy)
原题地址:https://leetcode.com/problems/maximum-subarray/description/题目: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array
2017-09-16 22:48:46 214
原创 LeetCode145. Binary Tree Postorder Traversal(hard)
原题地址:https://leetcode.com/problems/binary-tree-postorder-traversal/description/题目: Given a binary tree, return the postorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3},
2017-09-16 02:29:53 140
原创 LeetCode215. Kth Largest Element in an Array(Medium)
原题地址:https://leetcode.com/problems/kth-largest-element-in-an-array/description/题目: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not t
2017-09-16 01:41:16 156
原创 LeetCode 59.Spiral Matrix || (Medium)
原题地址:https://leetcode.com/problems/spiral-matrix-ii/description/题目描述: Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example, Given n = 3,You shoul
2017-09-13 18:06:57 217
原创 LeetCode 54.Spiral Matrix (Medium)
原题地址:https://leetcode.com/problems/spiral-matrix/description/题目描述: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,
2017-09-08 23:45:25 164
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人