自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

reigns的博客

不会vim不用三目

  • 博客(51)
  • 论坛 (1)
  • 收藏
  • 关注

原创 链表快排

具体思路就是两个指针,一个指针i负责分出大小两部分,一个指针j负责遍历,i左边的值都小于等于val,右边值都大于val,递归分治。#include <iostream>#include <vector>using namespace std;struct ListNode { int val; ListNode *next; ListNode(i...

2019-12-31 09:47:26 66

原创 LeetCode-1222. Queens That Can Attack the King

On an8x8chessboard, there can be multiple Black Queens and one White King.Given an array of integer coordinatesqueensthat represents the positions of the Black Queens, and a pair of coordinates...

2019-12-27 14:56:36 62

原创 LeetCode-1221. Split a String in Balanced Strings

Balancedstrings are those who have equal quantity of 'L' and 'R' characters.Given a balanced stringssplit it in the maximum amount of balanced strings.Return the maximum amount of splitted bala...

2019-12-27 14:07:46 91

原创 LeetCode-1249. Minimum Remove to Make Valid Parentheses

Given a stringsof'(',')'and lowercase English characters.Your task is to remove the minimum number of parentheses ('('or')',in any positions ) so that the resultingparentheses stringis ...

2019-12-26 17:23:42 280

原创 LeetCode-1248. Count Number of Nice Subarrays

Given an array of integersnumsand an integerk. Asubarrayis calledniceif there arekodd numbers on it.Return the number ofnicesub-arrays.Example 1:Input: nums = [1,1,2,1,1], k = 3O...

2019-12-26 17:04:47 134

原创 LeetCode-1247. Minimum Swaps to Make Strings Equal

You are given two stringss1ands2of equal lengthconsisting of letters"x"and"y"only. Your task is tomake these two strings equal to each other. You can swap any two characters that belong tod...

2019-12-26 15:46:03 269

原创 LeetCode-1289. Minimum Falling Path Sum II

Given a square gridof integersarr, afalling path with non-zero shiftsis a choice ofexactly one element from each row ofarr, such that no two elements chosen in adjacent rows are inthe same colu...

2019-12-26 15:08:40 244

原创 LeetCode-1288. Remove Covered Intervals

Given a list of intervals, remove all intervals that are covered by another interval in the list.Interval[a,b)is covered byinterval[c,d)if and only ifc <= aandb <= d.After doing so, r...

2019-12-26 11:21:29 132

原创 LeetCode-1287. Element Appearing More Than 25% In Sorted Array

Given aninteger arraysortedin non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time.Return that integer.Example 1:Input: arr = [1,2,2,6,6,6...

2019-12-26 11:20:32 51

原创 LeetCode-1286. Iterator for Combination

Design an Iterator class, which has:A constructor that takes a stringcharactersofsorted distinctlowercase English letters and a numbercombinationLengthas arguments. A functionnext()that ret...

2019-12-26 11:19:05 245

原创 LeetCode-1255. Maximum Score Words Formed by Letters

Given a list ofwords, list of singleletters(might be repeating)andscoreof every character.Return the maximum score ofanyvalid set of words formed by using the given letters (words[i]cannot...

2019-12-26 10:09:38 59

原创 LeetCode-1254. Number of Closed Islands

Given a 2Dgridconsists of0s(land)and1s(water). Anislandis a maximal 4-directionally connected group of0sand aclosed islandis an islandtotally(all left, top, right, bottom) surrounded b...

2019-12-25 18:05:16 73

原创 LeetCode-1253. Reconstruct a 2-Row Binary Matrix

Given the following details of a matrix withncolumns and2rows :The matrix is a binary matrix, which means each element in the matrix can be0or1. The sum of elements of the 0-th(upper) row is...

2019-12-25 16:50:40 52

原创 LeetCode-1252. Cells with Odd Values in a Matrix

Givennandmwhich are the dimensions of a matrix initialized by zeros and given an arrayindiceswhereindices[i] = [ri, ci]. For each pair of[ri, ci]you have to increment all cells in rowriand ...

2019-12-25 16:49:10 114

原创 LeetCode-1277. Count Square Submatrices with All Ones

Given am * nmatrix of ones and zeros, return how manysquaresubmatrices have all ones.Example 1:Input: matrix =[ [0,1,1,1], [1,1,1,1], [0,1,1,1]]Output: 15Explanation: There are ...

2019-12-25 15:51:14 174

原创 LeetCode-1276. Number of Burgers with No Waste of Ingredients

Given two integerstomatoSlicesandcheeseSlices. The ingredients of different burgers are as follows:Jumbo Burger:4 tomato slicesand 1 cheese slice. Small Burger:2 Tomato slicesand 1 cheese sl...

2019-12-25 15:42:17 97

原创 LeetCode-1298. Maximum Candies You Can Get from Boxes

Givennboxes, each box is given in the format[status, candies, keys, containedBoxes]where:status[i]: an integer which is1ifbox[i]is open and0ifbox[i]is closed. candies[i]:an integer rep...

2019-12-25 14:54:39 68

原创 LeetCode-1296. Divide Array in Sets of K Consecutive Numbers

Given an array of integersnumsand a positive integerk, find whether it's possible to divide this array intosets ofkconsecutive numbersReturnTrueif its possibleotherwisereturnFalse.Exa...

2019-12-24 16:43:49 261

原创 LeetCode-1297. Maximum Number of Occurrences of a Substring

Given a strings, return the maximum number of ocurrences ofanysubstringunder the following rules:The number of unique characters in the substring must be less than or equal tomaxLetters. The s...

2019-12-24 16:42:30 492

原创 LeetCode-543. Diameter of Binary Tree

Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of thelongestpath between any two nodes in a tree. This path may or may n...

2019-12-23 19:41:34 38

原创 LeetCode-560. Subarray Sum Equals K

Given an array of integers and an integerk, you need to find the total number of continuous subarrays whose sum equals tok.Example 1:Input:nums = [1,1,1], k = 2Output: 2Note:The length...

2019-12-23 19:39:40 29

原创 LeetCode-442. Find All Duplicates in an Array

Given an array of integers, 1 ≤ a[i] ≤n(n= size of array), some elements appeartwiceand others appearonce.Find all the elements that appeartwicein this array.Could you do it without extra ...

2019-12-19 17:41:16 40

原创 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.Coul...

2019-12-19 17:40:29 27

原创 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 mus...

2019-12-19 17:00:31 27

原创 LeetCode-416. Partition Equal Subset Sum

Given anon-emptyarray containingonly positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.Note:Each of the array eleme...

2019-12-19 16:44:19 28

原创 LeetCode-406. Queue Reconstruction by Height

Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers(h, k), wherehis the height of the person andkis the number of people in front of this ...

2019-12-19 16:03:20 113

原创 LeetCode-322. Coin Change

You are given coins of different denominations and a total amount of moneyamount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money ...

2019-12-19 15:18:36 33

原创 LeetCode-312. Burst Balloons

Givennballoons, indexed from0ton-1. Each balloon is painted with a number on it represented by arraynums. You are asked to burst all the balloons. If the you burst ballooniyou will getnums[le...

2019-12-19 14:27:26 43

原创 LeetCode-234. Palindrome Linked List

Given a singly linked list, determine if it is a palindrome.Example 1:Input: 1->2Output: falseExample 2:Input: 1->2->2->1Output: trueFollow up:Could you do it in O(n) time a...

2019-12-17 16:15:27 33

原创 LeetCode-208. Implement Trie (Prefix Tree)

Implement a trie withinsert,search, andstartsWithmethods.Example:Trie trie = new Trie();trie.insert("apple");trie.search("apple"); // returns truetrie.search("app"); // returns fals...

2019-12-17 15:51:09 38

原创 LeetCode-155. Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. top() -- Ge...

2019-12-17 15:34:07 21

原创 LeetCode-1293. Shortest Path in a Grid with Obstacles Elimination

Given am * ngrid, where each cell is either0(empty)or1(obstacle).In one step, you can move up, down, left or right from and to an empty cell.Return the minimum number of steps to walk from t...

2019-12-17 10:08:41 176

原创 LeetCode-1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold

Given am x nmatrixmatand an integerthreshold. Return the maximum side-length of a square with a sum less than or equal tothresholdor return0if there is no such square.Example 1:Inpu...

2019-12-17 09:38:43 289

原创 LeetCode-1291. Sequential Digits

Aninteger hassequential digitsif and only if each digit in the number is one more than the previous digit.Return asortedlist of all the integersin the range[low, high]inclusive that have seq...

2019-12-17 09:31:59 196

原创 LeetCode-1290. Convert Binary Number in a Linked List to Integer

Givenheadwhich is a reference node toa singly-linked list. The value of each node in the linked list is either 0 or 1. The linked list holds the binary representation of a number.Return thedecim...

2019-12-17 09:30:11 107

原创 LeetCode-1263. Minimum Moves to Move a Box to Their Target Location

Storekeeper is agamein which the player pushes boxes around in a warehousetrying to get them to target locations.The game is represented by agridof sizem x n, where each element is a wall, flo...

2019-12-13 12:56:18 112

原创 LeetCode-1262. Greatest Sum Divisible by Three

Given an arraynumsof integers, we need to find the maximum possible sum of elements of the array such that it is divisible by three.Example 1:Input: nums = [3,6,5,1,8]Output: 18Explanation...

2019-12-13 12:52:34 238

原创 LeetCode-1261. Find Elements in a Contaminated Binary Tree

Given abinary tree with the following rules:root.val == 0 IftreeNode.val == xandtreeNode.left != null, thentreeNode.left.val == 2 * x + 1 IftreeNode.val == xandtreeNode.right != null, then...

2019-12-13 12:48:47 135

原创 LeetCode-815. Bus Routes

We have a list of bus routes. Eachroutes[i]is a bus route that the i-th busrepeats forever. For example ifroutes[0] = [1, 5, 7], this means that the firstbus (0-th indexed) travels in the sequenc...

2019-12-13 09:02:25 53

原创 LeetCode-1269. Number of Ways to Stay in the Same Place After Some Steps

You have a pointer at index0in an array of sizearrLen. At each step, you can move 1 position to the left, 1 position to the rightin the array or stay in the same place (The pointer should not be ...

2019-12-12 11:51:42 318

空空如也

ReignsDu的留言板

发表于 2020-01-02 最后回复 2020-01-02

空空如也

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

TA关注的人 TA的粉丝

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