自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(40)
  • 收藏
  • 关注

原创 【Java】【LeetCode】260. Single Number III

题目:Given an array of numbersnums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.Example:Input: [1...

2019-07-30 22:25:31 108

原创 【Java】【LeetCode】338. Counting Bits

题目:Given a non negative integer numbernum. For every numbersiin the range0 ≤ i ≤ numcalculate the number of 1's in their binary representation and return them as an array.Example 1:Input: 2...

2019-07-27 17:18:09 232

原创 【Java】【LeetCode】201. Bitwise AND of Numbers Range

题目:Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.Example 1:Input: [5,7]Output: 4Example 2:Input: [0,1]Out...

2019-07-24 16:35:57 153

原创 【Java】【LeetCode】152. Maximum Product Subarray

题目:Given an integer arraynums, find the contiguous subarray within an array (containing at least one number) which has the largest product.Example 1:Input: [2,3,-2,4]Output: 6Explanation:[...

2019-07-23 22:22:34 124

原创 【Java】【LeetCode】238. Product of Array Except Self

题目:Given an arraynumsofnintegers wheren> 1, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Example:Input: [1,2,3,4]Out...

2019-07-23 16:43:53 95

原创 【Java】【LeetCode】165. Compare Version Numbers

题目:Compare two version numbersversion1andversion2.Ifversion1>version2return1;ifversion1<version2return-1;otherwise return0.You may assume that the version strings are non-emp...

2019-07-22 14:52:38 84

原创 【Java】【LeetCode】179. Largest Number

题目:Given a list of non negative integers, arrange them such that they form the largest number.Example 1:Input: [10,2]Output: "210"Example 2:Input: [3,30,34,5,9]Output: "9534330"Note:...

2019-07-22 14:32:38 142

原创 【Java】【LeetCode】228. Summary Ranges

题目:Given a sorted integer array without duplicates, return the summary of its ranges.Example 1:Input: [0,1,2,4,5,7]Output: ["0->2","4->5","7"]Explanation: 0,1,2 form a continuous range...

2019-07-21 16:37:14 122

原创 【Java】【LeetCode】334. Increasing Triplet Subsequence

题目:Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.Formally the function should:Return true if there existsi, j, ksuch thatarr[i]<...

2019-07-21 15:42:56 108

原创 【Java】【LeetCode】139. Word Break

题目:Given anon-emptystringsand a dictionarywordDictcontaining a list ofnon-emptywords, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.Note:...

2019-07-20 12:43:05 95

原创 【Java】【LeetCode】80. Remove Duplicates from Sorted Array II

题目:Given a sorted arraynums, remove the duplicatesin-placesuch that duplicates appeared at mosttwiceand return the new length.Do not allocate extra space for another array, you must do this b...

2019-07-19 17:26:40 75

原创 【Java】【LeetCode】73. Set Matrix Zeroes

题目:Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do itin-place.Example 1:Input: [ [1,1,1], [1,0,1], [1,1,1]]Output: [ [1,0,1], [0,0,0], [1,0,1]...

2019-07-18 16:16:14 77

原创 【Java】【LeetCode】151. Reverse Words in a String

题目:Given an input string, reverse the string word by word.Example 1:Input: "the sky is blue"Output:"blue is sky the"Example 2:Input: " hello world! "Output:"world! hello"Explanatio...

2019-07-17 22:30:01 95

原创 【Java】【LeetCode】8. String to Integer (atoi)

题目:Implementatoiwhichconverts 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 fro...

2019-07-17 19:01:07 93

原创 【Java】【LeetCode】6. ZigZag Conversion

题目:The 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 legibility)P A H NA P L ...

2019-07-17 18:22:56 108

原创 【Java】【LeetCode】5. Longest Palindromic Substring

题目:Given a strings, find the longest palindromic substring ins. You may assume that the maximum length ofsis 1000.Example 1:Input: "babad"Output: "bab"Note: "aba" is also a valid answer....

2019-07-17 12:32:10 93

原创 【Java】【LeetCode】39. Combination Sum

题目:Given asetof candidate numbers (candidates)(without duplicates)and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Thesamer...

2019-07-16 18:42:57 94

原创 【Java】【LeetCode】36. Valid Sudoku

题目:Determine if a9x9 Sudoku boardis valid.Only the filled cells need to be validatedaccording to the following rules:Each rowmust contain thedigits1-9without repetition. Each column must ...

2019-07-16 12:34:20 101

原创 【Java】【LeetCode】129. Sum Root to Leaf Numbers

题目:Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which represents the number123.Find the...

2019-07-15 12:26:26 94

原创 【Java】【LeetCode】111. Minimum Depth of Binary Tree

题目:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.Note:A leaf is a node with no ch...

2019-07-11 15:48:26 85

原创 【Java】【LeetCode】100. Same Tree

题目:Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same value.Exa...

2019-07-11 14:48:02 103

原创 【Java】【LeetCode】55. Jump Game

题目:Given 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 position.Determine ...

2019-07-11 11:23:48 97

原创 【Java】【LeetCode】112. Path Sum

题目: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 given sum.Note:A leaf is a node with no children.Exa...

2019-07-10 18:59:41 105

原创 【Java】【LeetCode】104. Maximum Depth of Binary Tree

题目:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Note:A leaf is a node with no ch...

2019-07-10 18:39:56 82

原创 【Java】【LeetCode】144. Binary Tree Preorder Traversal

题目:Given a binary tree, return thepreordertraversal of its nodes' values.Example:Input:[1,null,2,3] 1 \ 2 / 3Output:[1,2,3]Follow up:Recursive solution is trivial, ...

2019-07-10 18:06:57 143

原创 【Java】【LeetCode】94. Binary Tree Inorder Traversal

题目:Given a binary tree, return theinordertraversal of its nodes' values.Example:Input: [1,null,2,3] 1 \ 2 / 3Output: [1,3,2]Follow up:Recursive solution is trivial, co...

2019-07-10 17:00:30 102

原创 【LeetCode】TreeNode

public class TreeNode{ int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } @Override public String toString() { return "" + val...

2019-07-10 11:29:19 1838

原创 【Java】【LeetCode】122. Best Time to Buy and Sell Stock II

题目:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., b...

2019-07-09 18:50:23 73

原创 【Java】【LeetCode】53. Maximum Subarray

题目:Given an integer arraynums, find the contiguous subarray(containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],Output: 6Expl...

2019-07-09 18:19:53 181

原创 【Java】【LeetCode】121. Best Time to Buy and Sell Stock

题目:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the st...

2019-07-09 16:59:17 93

原创 【Java】【LeetCode】49. Group Anagrams

题目:Given an array of strings, group anagrams together.Example:Input: ["eat", "tea", "tan", "ate", "nat", "bat"],Output:[ ["ate","eat","tea"], ["nat","tan"], ["bat"]]Note:All inputs...

2019-07-09 16:35:22 79

原创 【Java】【LeetCode】88. Merge Sorted Array

题目:Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:The number of elements initialized innums1andnums2aremandnrespectively. You may assum...

2019-07-09 10:59:29 85

原创 【Java】【LeetCode】56. Merge Intervals

题目:Given a collection of intervals, merge all overlapping intervals.Example 1:Input: [[1,3],[2,6],[8,10],[15,18]]Output: [[1,6],[8,10],[15,18]]Explanation: Since intervals [1,3] and [2,6] ove...

2019-07-08 16:38:10 122

原创 【Java】【LeetCode】14. Longest Common Prefix

题目:Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string"".Example 1:Input: ["flower","flow","flight"]Ou...

2019-07-05 15:37:04 134

原创 【Java】【LeetCode】75. Sort Colors

题目:Given an array withnobjects colored red, white or blue, sort themin-placeso that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use t...

2019-07-05 14:50:50 112

原创 【Java】【LeetCode】26. Remove Duplicates from Sorted Array

题目:Given a sorted arraynums, remove the duplicatesin-placesuch that each element appear onlyonceand return the new length.Do not allocate extra space for another array, you must do this bymo...

2019-07-04 15:00:34 85

原创 【Java】【LeetCode】29. Divide Two Integers

题目:Given two integersdividendanddivisor, divide two integers without using multiplication, division and mod operator.Return the quotient after dividingdividendbydivisor.The integer divisio...

2019-07-04 11:28:05 128

原创 【Java】【LeetCode】137. Single Number II

题目:Given anon-emptyarray of integers, every element appearsthreetimes except for one, which appears exactly once. Find that single one.Note:Your algorithm should have a linear runtime comple...

2019-07-03 17:48:03 88

原创 【Java】【LeetCode】130. Surrounded Regions

题目:Given a 2D board containing'X'and'O'(the letter O), capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region.Example:X X X X...

2019-07-02 15:08:37 209

原创 【Java】【LeetCode】150. Evaluate Reverse Polish Notation

题目:Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.Note:Division between two inte...

2019-07-01 15:27:50 103

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除