leetcode每日一题202004
Bryan要加油
这个作者很懒,什么都没留下…
展开
-
202. Happy Number(Leetcode每日一题-2020.04.30)
ProblemWrite an algorithm to determine if a number n is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the ...原创 2020-04-30 22:53:42 · 250 阅读 · 0 评论 -
1095. Find in Mountain Array(Leetcode每日一题-2020.04.29)
Problem(This problem is an interactive problem.)You may recall that an array A is a mountain array if and only if:A.length >= 3There exists some i with 0 < i < A.length - 1 such that:A...原创 2020-04-29 22:49:33 · 187 阅读 · 0 评论 -
面试题56 - I. 数组中数字出现的次数(Leetcode每日一题-2020.04.28)
Problem一个整型数组 nums 里除两个数字之外,其他数字都出现了两次。请写程序找出这两个只出现一次的数字。要求时间复杂度是O(n),空间复杂度是O(1)。Example1输入:nums = [4,1,4,6]输出:[1,6] 或 [6,1]Example2输入:nums = [1,2,10,4,1,4,3,3]输出:[2,10] 或 [10,2]Solutiona...原创 2020-04-28 22:31:57 · 233 阅读 · 0 评论 -
33. Search in Rotated Sorted Array(Leetcode每日一题-2020.04.27)
ProblemSuppose 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 a target value to search. If ...原创 2020-04-27 22:15:53 · 183 阅读 · 0 评论 -
23. Merge k Sorted Lists(Leetcode每日一题-2020.04.26)
ProblemMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.ExampleInput:[1->4->5,1->3->4,2->6]Output: 1->1->2->3->4-&...原创 2020-04-26 09:03:19 · 251 阅读 · 0 评论 -
46. Permutations&&面试题 08.07. Permutation I LCCI(Leetcode每日一题-2020.04.25)
Problem46Given a collection of distinct integers, return all possible permutations.ExampleInput: [1,2,3]Output:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]来源:力扣(LeetCode)链接:https...原创 2020-03-29 17:12:33 · 291 阅读 · 0 评论 -
面试题51. 数组中的逆序对(Leetcode每日一题-2020.04.24)
占坑归并排序原创 2020-04-24 21:14:29 · 280 阅读 · 0 评论 -
面试题 08.11. Coin LCCI(Leetcode每日一题-2020.04.23)
占坑原创 2020-04-23 19:08:23 · 213 阅读 · 0 评论 -
199. Binary Tree Right Side View(Leetcode每日一题-2020.04.22)
占坑原创 2020-04-22 20:52:59 · 180 阅读 · 0 评论 -
1248. Count Number of Nice Subarrays(Leetcode每日一题-2020.04.21)
占坑原创 2020-04-21 19:10:42 · 217 阅读 · 0 评论 -
200. Number of Islands(Leetcode每日一题-2020.04.20)
占坑原创 2020-04-20 21:01:33 · 234 阅读 · 0 评论 -
466. Count The Repetitions(Leetcode每日一题-2020.04.19)
占坑没有思路原创 2020-04-19 18:54:45 · 213 阅读 · 0 评论 -
11. Container With Most Water(Leetcode每日一题-2020.04.18)
占坑原创 2020-04-18 10:17:02 · 252 阅读 · 0 评论 -
55. Jump Game(Leetcode每日一题-2020.04.17)
占坑Refhttps://leetcode-cn.com/problems/jump-game/solution/55-by-ikaruga/原创 2020-04-17 17:06:12 · 1961 阅读 · 0 评论 -
56. Merge Intervals(Leetcode每日一题-2020.04.16)
占坑原创 2020-04-16 22:41:18 · 185 阅读 · 0 评论 -
542. 01 Matrix(Leetcode每日一题-2020.04.15)
ProblemGiven a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.The distance between two adjacent cells is 1.Example1Input:[[0,0,0],[0,1,0],[0,0,0]]Output:[[0,0,0...原创 2020-04-15 20:51:58 · 210 阅读 · 0 评论 -
355. Design Twitter(Leetcode每日一题-2020.04.13)
占位原创 2020-04-14 22:51:13 · 194 阅读 · 0 评论 -
面试题 16.03. Intersection LCCI(Leetcode每日一题-2020.04.12)
占位原创 2020-04-14 22:50:11 · 264 阅读 · 0 评论 -
887. Super Egg Drop(Leetcode每日一题-2020.04.11)
占位原创 2020-04-14 22:48:00 · 225 阅读 · 0 评论 -
445. Add Two Numbers II(Leetcode每日一题-2020.04.14)
ProblemYou are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and ...原创 2020-04-14 22:46:25 · 188 阅读 · 0 评论 -
151. Reverse Words in a String(Leetcode每日一题-2020.04.10)
ProblemGiven an input string, reverse the string word by word.Example1Input: “the sky is blue”Output: “blue is sky the”Example2Input: " hello world! "Output: “world! hello”Explanation: Yo...原创 2020-04-10 22:23:24 · 467 阅读 · 0 评论 -
22. Generate Parentheses(Leetcode每日一题-2020.04.09)
ProblemGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.Example1Given n = 3, a solution set is:[ “((()))”, “(()())”, “(())()”, “()(()...原创 2020-04-09 22:46:03 · 154 阅读 · 0 评论 -
面试题13. 机器人的运动范围(Leetcode每日一题-2020.04.08)
Problem地上有一个m行n列的方格,从坐标 [0,0] 到坐标 [m-1,n-1] 。一个机器人从坐标 [0, 0] 的格子开始移动,它每次可以向左、右、上、下移动一格(不能移动到方格外),也不能进入行坐标和列坐标的数位之和大于k的格子。例如,当k为18时,机器人能够进入方格 [35, 37] ,因为3+5+3+7=18。但它不能进入方格 [35, 38],因为3+5+3+8=19。请问该机...原创 2020-04-08 23:31:30 · 348 阅读 · 0 评论 -
48. Rotate Image&&面试题 01.07. Rotate Matrix LCCI(Leetcode每日一题-2020.04.07)
ProblemGiven an image represented by an N x N matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you do this in place?ExampleGiven matrix =[[...原创 2020-04-07 23:21:47 · 337 阅读 · 0 评论 -
72. Edit Distance(Leetcode每日一题-2020.04.06)
ProblemGiven two words word1 and word2, find the minimum number of operations required to convert word1 to word2.You have the following 3 operations permitted on a word:Insert a characterDelete a...原创 2020-04-06 15:25:05 · 224 阅读 · 0 评论 -
460. LFU缓存(Leetcode每日一题-2020.04.05)
ProblemDesign and implement a data structure for Least Frequently Used (LFU) cache. It should support the following operations: get and put.get(key) - Get the value (will always be positive) of the ...原创 2020-04-05 18:00:56 · 213 阅读 · 0 评论 -
42. Trapping Rain Water(Leetcode每日一题-2020.04.04)
ProblemGiven n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.ExampleInput: [0,1,0,2,1,0,1,3,2,1,2,1...原创 2020-04-04 21:55:05 · 282 阅读 · 0 评论 -
8. String to Integer (atoi)(Leetcode每日一题-2020.04.03)
ProblemImplement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting f...原创 2020-04-03 20:43:14 · 219 阅读 · 0 评论 -
289. Game of Life(Leetcode每日一题-2020.04.02)
ProblemAccording to the Wikipedia’s article: “The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.”Given a board with...原创 2020-04-02 20:56:32 · 266 阅读 · 0 评论 -
1111. Maximum Nesting Depth of Two Valid Parentheses Strings(Leetcode每日一题-2020.04.01)
ProblemA string is a valid parentheses string (denoted VPS) if and only if it consists of “(” and “)” characters only, and:It is the empty string, orIt can be written as AB (A concatenated with B)...原创 2020-04-01 20:29:04 · 285 阅读 · 0 评论