LeetCode
文章平均质量分 74
LeetCode算法刷题,学习JAVA算法。
梅森上校
十多年软件行业从业经验,热爱技术,精于项目管理和研发团队建设。闲暇至于,喜欢欣赏音乐,看看电影;摆弄摆弄茶道,让身心得以调整和休息。
展开
-
LeetCode刷题:349. Intersection of Two Arrays&350. Intersection of Two Arrays II
LeetCode刷题:349. Intersection of Two Arrays&350. Intersection of Two Arrays II原题链接:349.Intersection of Two Arrayshttps://leetcode.com/problems/intersection-of-two-arrays/350.Intersection o...原创 2019-06-09 01:05:19 · 235 阅读 · 0 评论 -
LeetCode刷题:260. Single Number III
LeetCode刷题:260. Single Number III原题链接:https://leetcode.com/problems/single-number-iii/Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appe...原创 2019-06-07 18:27:04 · 240 阅读 · 0 评论 -
LeetCode刷题:137. Single Number II
LeetCode刷题:137. Single Number II原题链接:https://leetcode.com/problems/single-number-ii/Given a non-empty array of integers, every element appears three times except for one, which appears exactly onc...原创 2019-06-07 18:20:29 · 158 阅读 · 0 评论 -
LeetCode刷题:136. Single Number
LeetCode刷题:136. Single Number原题链接:https://leetcode.com/problems/single-number/Given a non-empty array of integers, every element appears twice except for one. Find that single one.Note:Your al...原创 2019-06-07 18:13:13 · 178 阅读 · 0 评论 -
LeetCode刷题:41. First Missing Positive
LeetCode刷题:41. First Missing Positive原题链接:https://leetcode.com/problems/first-missing-positive/Given an unsorted integer array, find the smallest missing positive integer.Example 1:Input: [1,2...原创 2019-06-07 14:49:30 · 176 阅读 · 0 评论 -
LeetCode刷题:268. Missing Number
LeetCode刷题:268. Missing Number原题链接:https://leetcode.com/problems/missing-number/Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array...原创 2019-06-07 15:07:29 · 208 阅读 · 0 评论 -
LeetCode刷题:442. Find All Duplicates in an Array
LeetCode刷题:442. Find All Duplicates in an Array原题链接:https://leetcode.com/problems/find-all-duplicates-in-an-array/Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear...原创 2019-06-07 14:26:43 · 114 阅读 · 0 评论 -
LeetCode刷题:403. Frog Jump 青蛙过河问题JAVA算法设计
LeetCode刷题:403. Frog Jump 青蛙过河问题JAVA算法设计A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must n...原创 2019-05-25 22:29:55 · 1294 阅读 · 0 评论 -
LeetCode刷题:301. Remove Invalid Parentheses (DFS算法设计和BFS算法设计)
LeetCode刷题:301. Remove Invalid Parentheses原题链接:https://leetcode.com/problems/remove-invalid-parentheses/Remove the minimum number of invalid parentheses in order to make the input string valid. Re...原创 2019-05-25 22:18:09 · 248 阅读 · 0 评论 -
LeetCode刷题:1003. Check If Word Is Valid After Substitutions
LeetCode刷题:1003. Check If Word Is Valid After Substitutions原题链接:https://leetcode.com/problems/check-if-word-is-valid-after-substitutions/We are given that the string "abc" is valid.From any vali...原创 2019-05-25 21:51:10 · 177 阅读 · 0 评论 -
LeetCode刷题:20. Valid Parentheses
LeetCode刷题:20. Valid Parentheses原题链接:https://leetcode.com/problems/valid-parentheses/Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string i...原创 2019-05-25 21:44:53 · 202 阅读 · 0 评论 -
JAVA算法:括号配对问题与卡塔兰数(Catalan number)
JAVA算法:括号配对问题与卡塔兰数(Catalan number)LeetCode中第22题目:22.Generate Parentheses原题链接:https://leetcode.com/problems/generate-parentheses/Given n pairs of parentheses, write a function to generate all co...原创 2019-05-19 18:48:19 · 1100 阅读 · 0 评论 -
LeetCode刷题:30. Substring with Concatenation of All Words
LeetCode刷题:30. Substring with Concatenation of All Words原题链接:https://leetcode.com/problems/substring-with-concatenation-of-all-words/You are given a string, s, and a list of words, words, that are...原创 2019-05-19 00:18:43 · 114 阅读 · 0 评论 -
LeetCode刷题:71. Simplify Path
LeetCode刷题:71. Simplify Path原题链接:https://leetcode.com/problems/simplify-path/Given an absolute path for a file (Unix-style), simplify it. Or in other words, convert it to the canonical path.In a...原创 2019-05-17 22:38:22 · 213 阅读 · 0 评论 -
LeetCode刷题:76. Minimum Window Substring (JAVA 算法实现)
LeetCode刷题:76. Minimum Window Substring原题链接:https://leetcode.com/problems/minimum-window-substring/Given a string S and a string T, find the minimum window in S which will contain all the characte...原创 2019-05-14 23:40:10 · 598 阅读 · 0 评论 -
LeetCode刷题:925. Long Pressed Name
LeetCode刷题:925. Long Pressed Name原题链接:https://leetcode.com/problems/long-pressed-name/Your friend is typing his name into a keyboard. Sometimes, when typing a character c, the key might get long ...原创 2019-05-12 22:36:39 · 207 阅读 · 0 评论 -
LeetCode刷题:546. Remove Boxes —JAVA代码DP+DFS
LeetCode刷题:546. Remove Boxes原题链接:https://leetcode.com/problems/remove-boxes/Given several boxes with different colors represented by different positive numbers.You may experience several rounds ...原创 2019-05-12 22:20:39 · 505 阅读 · 0 评论 -
LeetCode刷题:132. Palindrome Partitioning II (JAVA算法实现)
LeetCode刷题:132. Palindrome Partitioning II原题链接:https://leetcode.com/problems/palindrome-partitioning-ii/Given a string s, partition s such that every substring of the partition is a palindrome.R...原创 2019-05-12 12:04:17 · 386 阅读 · 0 评论 -
LeetCode刷题:664. Strange Printer
LeetCode刷题:664. Strange Printer原题链接:https://leetcode.com/problems/strange-printer/There is a strange printer with the following two special requirements:The printer can only print a sequence of ...原创 2019-05-12 11:47:51 · 219 阅读 · 0 评论 -
LeetCode刷题:1025. Divisor Game (JAVA动态规划算法)
LeetCode刷题:1025. Divisor Game原题链接:https://leetcode.com/problems/divisor-game/Alice and Bob take turns playing a game, with Alice starting first.Initially, there is a number N on the chalkboard. ...原创 2019-05-12 11:16:42 · 696 阅读 · 0 评论 -
LeetCode刷题:871. Minimum Number of Refueling Stops
LeetCode刷题:871. Minimum Number of Refueling Stops原题链接:https://leetcode.com/problems/minimum-number-of-refueling-stops/A car travels from a starting position to a destination which is target miles ...原创 2019-05-12 11:05:55 · 401 阅读 · 0 评论 -
LeetCode刷题:902. Numbers At Most N Given Digit Set
LeetCode刷题:902. Numbers At Most N Given Digit Set原题链接:https://leetcode.com/problems/numbers-at-most-n-given-digit-set/We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','...原创 2019-05-11 23:20:55 · 431 阅读 · 0 评论 -
LeetCode刷题:27. Remove Element
LeetCode刷题:27. Remove Element原题链接:https://leetcode.com/problems/remove-element/Given an array nums and a value val, remove all instances of that value in-place and return the new length.Do not a...原创 2019-05-11 21:17:18 · 177 阅读 · 0 评论 -
LeetCode刷题:26. Remove Duplicates from Sorted Array
LeetCode刷题:26. Remove Duplicates from Sorted Array原题:https://leetcode.com/problems/remove-duplicates-from-sorted-array/Given a sorted arraynums, remove the duplicatesin-placesuch that each elem...原创 2019-05-11 21:05:59 · 190 阅读 · 0 评论 -
LeetCode刷题:771. Jewels and Stones
LeetCode刷题:771. Jewels and Stones原题链接:https://leetcode.com/problems/jewels-and-stones/You're given stringsJrepresenting the types of stones that are jewels, andSrepresenting the stones you hav...原创 2019-05-11 20:52:28 · 170 阅读 · 0 评论 -
LeetCode刷题:682. Baseball Game
LeetCode刷题:682. Baseball Game原题链接:https://leetcode.com/problems/baseball-game/You're now a baseball game point recorder.Given a list of strings, each string can be one of the 4 following types:...原创 2019-05-11 21:40:48 · 213 阅读 · 0 评论 -
LeetCode刷题:74. Search a 2D Matrix
LeetCode刷题:74. Search a 2D Matrix原题链接:https://leetcode.com/problems/search-a-2d-matrix/Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following prop...原创 2019-05-09 21:40:14 · 169 阅读 · 0 评论 -
LeetCode刷题:547. Friend Circles
LeetCode刷题:547. Friend Circles原题链接:https://leetcode.com/problems/friend-circles/There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nat...原创 2019-05-09 21:25:08 · 278 阅读 · 0 评论 -
LeetCode刷题:79. Word Search — JAVA DFS算法
LeetCode刷题:79. Word Search原题链接:https://leetcode.com/problems/word-search/Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially...原创 2019-05-07 19:16:02 · 372 阅读 · 0 评论 -
LeetCode刷题:741. Cherry Pickup —摘樱桃 动态规划
LeetCode刷题:741. Cherry Pickup —摘樱桃 动态规划原题链接:https://leetcode.com/problems/cherry-pickup/In a N x N grid representing a field of cherries, each cell is one of three possible integers.0 means the...原创 2019-05-03 22:03:08 · 1420 阅读 · 0 评论 -
LeetCode刷题:887. Super Egg Drop
LeetCode刷题:887. Super Egg Drop原题链接:https://leetcode.com/problems/super-egg-drop/You are given K eggs, and you have access to a building with N floors from 1 to N.Each egg is identical in functi...原创 2019-05-03 12:57:28 · 461 阅读 · 0 评论 -
LeetCode刷题:498. Diagonal Traverse
LeetCode刷题:498. Diagonal Traverse原题链接:https://leetcode.com/problems/diagonal-traverse/Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as s...原创 2019-05-02 21:45:34 · 164 阅读 · 0 评论 -
LeetCode刷题:Jump Game—跳跃游戏 45题&55题(贪心算法,回溯算法,动态规划)
LeetCode刷题:45. Jump Game IILeetCode中有两道关于Jump Game的题目,分别是45.Jump Game IIhttps://leetcode.com/problems/jump-game-ii/55. Jump Gamehttps://leetcode.com/problems/jump-game/这两道题目的差别在哪里呢?55题是判断你是...原创 2019-05-02 20:40:21 · 577 阅读 · 0 评论 -
LeetCode刷题:416. Partition Equal Subset Sum
LeetCode刷题:416. Partition Equal Subset SumGiven a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subse...原创 2019-05-02 17:15:21 · 148 阅读 · 0 评论 -
LeetCode刷题:89. Gray Code
LeetCode刷题:89. Gray Code原题链接:https://leetcode.com/problems/gray-code/The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n re...原创 2019-04-21 22:34:04 · 275 阅读 · 0 评论 -
LeetCode刷题:54. Spiral Matrix
LeetCode刷题:54. Spiral Matrix原题链接:https://leetcode.com/problems/spiral-matrix/Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.Example 1:I...原创 2019-04-18 22:56:44 · 162 阅读 · 0 评论 -
LeetCode刷题:55. Jump Game 跳跃游戏
LeetCode刷题:55. Jump Game 跳跃游戏原题链接:https://leetcode.com/problems/jump-game/Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in th...原创 2019-04-11 20:32:47 · 375 阅读 · 0 评论 -
LeetCode刷题:233. Number of Digit One
LeetCode刷题:233. Number of Digit One原题链接:https://leetcode.com/problems/number-of-digit-one/Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or ...原创 2019-04-10 20:23:35 · 271 阅读 · 0 评论 -
LeetCode刷题:343. Integer Break 整数分割
LeetCode刷题:343. Integer Break 整数分割原题链接:https://leetcode.com/problems/integer-break/Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of t...原创 2019-04-10 20:01:25 · 260 阅读 · 0 评论 -
LeetCode刷题:32. Longest Valid Parentheses
LeetCode刷题:32. Longest Valid Parentheses原题链接:https://leetcode.com/problems/longest-valid-parentheses/Given a string containing just the characters '(' and ')', find the length of the longest valid...原创 2019-04-10 00:18:50 · 241 阅读 · 0 评论