- 博客(30)
- 收藏
- 关注
原创 Leetcode题解-62. Unique Paths & 63. Unique Paths II
Leetcode题解-62. Unique Paths & 63. Unique Paths II62.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
2018-01-13 15:21:08
235
原创 Leetcode题解-55. Jump Game
Leetcode题解-55. Jump GameGiven 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 posit
2018-01-13 14:55:30
355
原创 Leetcode题解-198. House Robber
Leetcode题解-198. House RobberYou 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
2018-01-03 13:52:38
284
原创 Leetcode题解-747. Min Cost Climbing Stairs
Leetcode题解-747. Min Cost Climbing StairsOn a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed).Once you pay the cost, you can either climb one or two steps. You need to f
2018-01-03 09:24:28
321
原创 算法概论8.3-吝啬SAT
吝啬SAT8.3 吝啬SAT问题是这样的:给定一组子句(每个子句都是其中文字的析取)和整数k,求一个最多有k个变量为true的满足赋值——如果该赋值存在。证明吝啬SAT是NP-完全问题。 前提已知SAT问题是NP-完全问题证明将吝啬SAT问题归约到SAT问题。假设SAT问题有k个变量,则SAT问题最多只能有k个变量为true,则等价于吝啬SAT问题。证毕
2017-12-31 18:20:24
298
原创 Leetcode题解-39. Combination Sum
Leetcode题解-39. Combination SumGiven 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 repeate
2017-12-24 17:33:07
256
原创 Leetcode题解-30. Substring with Concatenation of All Words
Leetcode题解-30. Substring with Concatenation of All Words题目You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is
2017-12-17 10:11:25
333
原创 Leetcode题解-25. Reverse Nodes in k-Group
Leetcode题解-25. Reverse Nodes in k-GroupGiven a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the length o
2017-12-07 17:16:01
307
原创 Leetcode题解-38. Count and Say
Leetcode题解-38. Count and Say题目The count-and-say sequence is the sequence of integers with the first five terms as following:111211211111221 1 is read off as “one 1” or 11. 11 is read off as “two
2017-12-03 21:29:34
214
原创 Leetcode题解-48. Rotate Image
Leetcode题解-48. Rotate ImageYou are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note: You have to rotate the image in-place, which means you have to modify
2017-11-19 23:06:08
194
原创 Leetcode题解-3Sum&3Sum Closest
Leetcode题解-3Sum&3Sum Closest3SumGiven an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solu
2017-11-12 22:30:42
313
原创 Leetcode题解-33. Search in Rotated Sorted Array
Leetcode题解-33. Search in Rotated Sorted ArraySuppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given
2017-11-05 18:43:06
242
原创 Leetcode题解-31. Next Permutation
Leetcode题解-31. Next PermutationImplement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange
2017-10-29 16:45:04
427
原创 Leetcode题解-24. Swap Nodes in Pairs
Leetcode题解-24. Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For example, Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should u
2017-10-16 19:26:35
249
原创 Leetcode题解-23. Merge k Sorted Lists
Leetcode题解-23. Merge k Sorted ListsMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.(链表元素从小到大排序)思路之前做过合并2个有序链表的题目,这题无非就是把合并两条链表后产生的新链表和剩下的链表中的一条进行合并,直到没
2017-10-16 15:56:37
199
原创 Leetcode题解-18. 4Sum
Leetcode题解-18. 4SumGiven an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:
2017-10-16 13:18:00
227
原创 Leetcode题解-21. Merge Two Sorted Lists
Leetcode题解-21. Merge Two Sorted ListsMerge 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(把两个从小到大的序列链表合并成一个从小到大的链
2017-10-13 09:38:49
234
原创 Leetcode题解-17. Letter Combinations of a Phone Number
Leetcode题解-17. Letter Combinations of a Phone NumberGiven a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telepho
2017-10-12 16:02:33
251
原创 Leetcode题解-14. Longest Common Prefix
Leetcode题解-14. Longest Common Prefix给出一个字符串数组,求出所有字符串最长的公共前缀思路 想法1:对每个字符串相同位置的字符进行比较,直到出现不同字符或者超过其中一个字符串长度结束比较 想法2:每次将前缀和一个字符串的比较,取前缀和该字符串的最长公共前缀,直到比较完所有字符串代码想法1的代码string longestCommonPrefix(vector<s
2017-10-11 10:13:05
196
原创 Leetcode题解-500. Keyboard Row
Leetcode题解-500. Keyboard RowGiven a List of words, return the words that can be typed using letters of alphabet on only one row’s of American keyboard like the image below.American keyboard Example 1:
2017-09-30 17:51:32
288
原创 Leetcode题解-11. Container With Most Water
Leetcode题解-11. Container With Most WaterGiven n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line
2017-09-30 13:44:46
227
原创 Leetcode题解-561. Array Partition I
Leetcode题解-561. Array Partition IGiven an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all
2017-09-29 09:40:53
215
原创 Leetcode题解-617. Merge Two Binary Trees
Leetcode题解-617. Merge Two Binary TreesGiven two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need t
2017-09-29 08:36:36
260
原创 Leetcode题解-657. Judge Route Circle
Leetcode题解-657. Judge Route CircleInitially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place.The
2017-09-28 13:02:31
231
原创 Leetcode题解-461. Hamming Distance
Leetcode题解-461. Hamming Distance【easy】The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hammin
2017-09-28 10:51:10
225
原创 Leetcode题解-7&9
Leetcode题解-7&9由于题目比较简单而且两道题思路比较接近,将两道题合起来写7. Reverse Integer【easy】Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321Note: The input is assumed to be a 32-bit s
2017-09-28 10:28:22
168
原创 Leetcode题解-6. ZigZag Conversion
Leetcode题解-6. ZigZag ConversionThe string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better
2017-09-19 17:57:45
375
原创 Leetcode题解-5. Longest Palindromic Substring
5. Longest Palindromic SubstringGiven a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad"Output: "bab"N
2017-09-17 22:36:46
276
原创 Leetcode题解-3. Longest Substring Without Repeating Characters
3. Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", w
2017-09-10 23:08:20
228
原创 uwp之图片旋转动画实现
先放效果图。类似网易云音乐播放音乐时封面旋转效果两种实现方式,分别是前端(xaml)和后台(c#代码)实现,右边的图片旋转是在xaml实现,左边的长方形(其实是个Button控件)旋转是在c#代码里面实现xaml代码如下
2017-05-18 14:44:20
2272
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人