![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode
Joyer_99
这个作者很懒,什么都没留下…
展开
-
459. Repeated Substring Pattern[Easy]
DescriptionGiven a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of low...原创 2019-11-22 13:00:40 · 124 阅读 · 0 评论 -
72. Edit Distance[Hard]
DescriptionGiven 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 characterDele...原创 2019-11-14 14:46:37 · 109 阅读 · 0 评论 -
448. Find All Numbers Disappeared in an Array[Easy]
DescriptionGiven an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in this a...原创 2019-11-12 15:15:49 · 106 阅读 · 0 评论 -
【Leetcode】Power of N
在Leetcode上发现了三个很有趣的Power of N的题,分别是判断一个数是否是2、3、4的n次幂。在第一次刷题的时候,全部采用的都是将数字num转换为n进制,然后判断该进制是否为1个1加上x个0的形式,从而得到结果。在第二次刷题的时候,特别注意了Follow up: Could you do it without using any loop / recursion?,从而开始思考怎么...原创 2019-11-03 15:02:21 · 136 阅读 · 0 评论 -
【Leetcode】322. Coin Change[Medium]
DescriptionYou 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 that amou...原创 2019-09-11 14:59:17 · 94 阅读 · 0 评论 -
【Leetcode】33. Search in Rotated Sorted Array[Medium]
DescriptionSuppose 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....原创 2019-09-11 11:24:19 · 84 阅读 · 0 评论 -
【Leetcode】162. Find Peak Element[Medium]
DescriptionA peak element is an element that is greater than its neighbors.Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return its index.The array may contain multi...原创 2019-09-08 14:59:46 · 178 阅读 · 0 评论 -
【Leetcode】347. Top K Frequent Elements[Medium]
DescriptionGiven a non-empty array of integers, return the k most frequent elements.ExampleExample 1:Input: nums = [1,1,1,2,2,3], k = 2Output: [1,2]Example 2:Input: nums = [1], k = 1Output: [...原创 2019-09-07 22:50:09 · 90 阅读 · 0 评论 -
【Leetcode】79. Word Search[Medium]
DescriptionGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally or v...原创 2019-09-07 14:52:03 · 79 阅读 · 0 评论 -
【Leetcode】207. Course Schedule[Medium]
DescriptionThere are a total of n courses you have to take, labeled from 0 to n-1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expresse...原创 2019-10-05 14:25:33 · 105 阅读 · 0 评论 -
【Leetcode】210. Course Schedule II[Medium]
DescriptionThere are a total of n courses you have to take, labeled from 0 to n-1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expresse...原创 2019-10-05 14:54:23 · 93 阅读 · 0 评论 -
【Leetcode】300. Longest Increasing Subsequence[Medium]
DescriptionGiven an unsorted array of integers, find the length of longest increasing subsequence.Note:There may be more than one LIS combination, it is only necessary for you to return the length...原创 2019-09-11 16:59:16 · 118 阅读 · 0 评论 -
【Leetcode】621. Task Scheduler[Medium]
DescriptionGiven a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks. Tasks could be done without original order. Each...原创 2019-09-17 15:27:41 · 71 阅读 · 0 评论 -
【Leetcode】371. Sum of Two Integers [Easy]
DescriptionCalculate the sum of two integers a and b, but you are not allowed to use the operator + and -.ExampleExample 1:Input: a = 1, b = 2Output: 3Example 2:Input: a = -2, b = 3Output: 1...原创 2019-09-04 10:58:22 · 66 阅读 · 0 评论 -
【Leetcode】88. Merge Sorted Array[Easy]
DescriptionGiven two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:The number of elements initialized in nums1 and nums2 are m and n respectively.You may ...原创 2019-09-05 12:45:25 · 79 阅读 · 0 评论 -
【Leetcode】326. Power of Three[Easy]
DescriptionGiven an integer, write a function to determine if it is a power of three.ExampleExample 1:Input: 27Output: trueExample 2:Input: 45Output: falseSolvingConverting the input into ...原创 2019-09-05 13:18:31 · 86 阅读 · 0 评论 -
【Leetcode】160. Intersection of Two Linked Lists[Easy]
DescriptionWrite a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1->a2->c1->c2->c3B: b1->b...原创 2019-09-07 00:16:07 · 76 阅读 · 0 评论 -
【Leetcode】124. Binary Tree Maximum Path Sum[Hard]
DescriptionGiven a non-empty binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-chil...原创 2019-10-04 21:43:35 · 94 阅读 · 0 评论 -
【Leetcode】3. Longest Substring Without Repeating Characters [Medium]
DescriptionGiven a string, find the length of the longest substring without repeating characters.ExampleExample1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3...原创 2019-09-04 10:55:38 · 67 阅读 · 0 评论 -
【Leetcode】98. Validate Binary Search Tree[Medium]
DescriptionGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node’s...原创 2019-09-05 11:59:41 · 141 阅读 · 0 评论 -
【Leetcode】73. Set Matrix Zeroes[Medium]
DescriptionGiven a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place.Follow up:A straight forward solution using O(mn) space is probably a bad idea.A simple imp...原创 2019-09-06 15:12:49 · 81 阅读 · 0 评论 -
【Leetcode】230. Kth Smallest Element in a BST[Medium]
DescriptionGiven a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST’s total elements.ExampleExample 1:In...原创 2019-09-07 13:32:22 · 67 阅读 · 0 评论 -
【Leetcode】238. Product of Array Except Self[Medium]
DescriptionGiven an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Note: Please solve it with...原创 2019-09-26 16:38:39 · 79 阅读 · 0 评论 -
【Leetcode】53. Maximum Subarray [Easy]
DescriptionGiven an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.ExampleInput: [-2,1,-3,4,-1,2,1,-5,4],Output: 6E...原创 2019-09-04 10:57:22 · 90 阅读 · 0 评论