自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 【LeetCode】63. Unique Paths II

题目: 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 right at any point in time. The robot is trying to reach the...

2019-08-30 01:19:16 110

原创 【LeetCode】62. 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 right at any point in time. The robot is trying to reach the...

2019-08-30 01:05:03 102

原创 【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 if ...

2019-08-30 00:30:12 119

原创 【Leetcode】39. Combination Sum

题目: Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target. The same rep...

2019-08-29 05:16:18 133

原创 【LeetCode】34. Find First and Last Position of Element in Sorted Array

题目: iven an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. Your algorithm’s runtime complexity must be in the order of O(log n). If th...

2019-08-25 19:56:16 154

原创 【LeetCode】33. Search in Rotated Sorted Array

题目: Suppose 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 foun...

2019-08-23 17:57:42 99

原创 【LeetCode】31. Next Permutation

题目: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possibl...

2019-08-23 17:32:44 143

原创 【LeetCode】18. 4Sum

题目: Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of...

2019-08-23 15:22:21 95

原创 【LeetCode】16. 3Sum Closest

题目: Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input wo...

2019-08-23 14:45:44 102

原创 【LeetCode】15. 3Sum

题目: Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: The solution set must not co...

2019-08-22 20:13:35 119

原创 【Leetcode】11. Container With Most Water

题目: Given 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 i is at (i, ai) and (i, 0). Find t...

2019-08-22 19:24:32 118

原创 【LeetCode】109. Convert Sorted List to Binary Search Tree

题目: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is defined as a binary tree in which t...

2019-08-21 13:07:10 138

原创 【Leetcode】86. Partition List

题目: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each o...

2019-08-20 19:22:44 102

原创 【Leetcode】92. Reverse Linked List II

题目: Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: Input: 1->2->3->4->5->NULL, m = 2, n = 4 Output: 1->4->3->2->5-...

2019-08-20 18:36:26 90

原创 【Leetcode】82. Remove Duplicates from Sorted List II

题目: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Example 1: Input: 1->2->3->3->4->4->5 Output: 1-&g...

2019-08-19 15:18:17 95

原创 【LeetCode】61. Rotate List

题目: Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1: Input: 1->2->3->4->5->NULL, k = 2 Output: 4->5->1->2->3->NULL Expla...

2019-08-19 14:29:33 86

原创 【LeetCode】24. Swap Nodes in Pairs

题目: Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list’s nodes, only nodes itself may be changed. Example: Given 1->2->3->4, you...

2019-08-18 18:05:35 107

原创 【LeetCode】19. Remove Nth Node From End of List

题目: Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, t...

2019-08-18 17:02:36 149

原创 【LeetCode】2. Add Two Numbers

题目: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and retu...

2019-08-18 16:38:23 88

原创 【二刷】26. Remove Duplicates from Sorted Array

题目: Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this by modi...

2019-08-18 14:12:37 114

原创 【二刷】1. Two Sum

题目: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the sa...

2019-08-18 11:34:08 89

原创 【LeetCode】520. Detect Capital

题目: Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of the following cases holds: All letters in thi...

2019-08-16 19:19:11 81

原创 【LeetCode】509. Fibonacci Number

题目: The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is, F(0) = 0, ...

2019-08-16 19:09:14 102

原创 【LeetCode】507. Perfect Number

题目: We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself. Now, given an integer n, write a function that returns true when it is a per...

2019-08-16 18:47:02 72

原创 【LeetCode】506. Relative Ranks

题目: Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: “Gold Medal”, “Silver Medal” and “Bronze Medal”. Example 1: Inpu...

2019-08-16 18:36:31 81

原创 【LeetCode】504. Base 7

题目: Given an integer, return its base 7 string representation. Example 1: Input: 100 Output: “202” Example 2: Input: -7 Output: “-10” Note: The input will be in range of [-1e7, 1e7]. 思路: 开始我没懂这道题啥意思。。...

2019-08-16 17:37:32 81

原创 【LeetCode】501. Find Mode in Binary Search Tree

题目: Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is defined as follows: The left subtree of a node conta...

2019-08-16 16:09:09 78

原创 【Leetcode】500. Keyboard Row

题目: Given 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. Example: Input: [“Hello”, “Alaska”, “Dad”, “Peace”]...

2019-08-16 15:35:48 66

原创 【Leetcode】496. Next Greater Element I

题目: You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s elements in the corresponding places of nums...

2019-08-15 20:04:36 113

原创 【Leetcode】492. Construct the Rectangle

题目: For a web developer, it is very important to know how to design a web page’s size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose leng...

2019-08-15 19:19:09 76

原创 【Leetcode】485. Max Consecutive Ones

题目: Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last three digits are consecutive ...

2019-08-15 19:02:47 145

原创 【LeetCode】448. Find All Numbers Disappeared in an Array

题目: Given 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 array. Co...

2019-08-15 00:27:31 85

原创 【Leetcode】447. Number of Boomerangs

题目: Given n points in the plane that are all pairwise distinct, a “boomerang” is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the order of th...

2019-08-14 20:11:39 78

原创 【小记】Java 中 int 转换为 char 的一个方法

写Leetcode 443. String Compression 的时候一直被这个卡出了。。。 最后终于明白了。。。。 String一个东西,是你的int+"", 然后再写个循环把它charAt一下 String times = (j - i + 1) + “”; for(int k=0;k<times.length();k++){ chars[cur++]=times.charAt(k)...

2019-08-13 18:18:05 151

原创 【Leetcode】441. Arranging Coins

题目: You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. Given n, find the total number of full staircase rows that can be formed. n ...

2019-08-13 17:11:24 74

原创 【Leetcode】437. Path Sum III

题目: You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need to start or end at the root or a leaf, but it m...

2019-08-12 23:50:10 90

原创 【Leetcode】434. Number of Segments in a String

题目: Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters. Please note that the string does not contain any non-printable characters....

2019-08-12 20:01:30 88

原创 【Leetcode】429. N-ary Tree Level Order Traversal

题目: Given an n-ary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level). For example, given a 3-ary tree: 注:好像如果是正常的树,就是root.left 和 root.righ。如果是这种就是写个...

2019-08-12 19:38:31 77

原创 【Leetcode】415. Add Strings

题目: Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: The length of both num1 and num2 is < 5100. Both num1 and num2 contains only digits 0...

2019-08-12 19:14:34 78

原创 【Leetcode】414.Third Maximum Number

题目: Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n). 注意: 1.他说是非空的,数组有可能是[1,2]这种...

2019-08-12 15:34:57 99

空空如也

空空如也

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

TA关注的人

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