Prefix and brush question summary of leetcode 2
Prefix and brush question summary of leetcode 2
1 - region and retrieval - array immutable Title Link: Title Link stamp here!!!
Idea: simple prefix sum. During initialization, use the sum array to store the prefix sum of the num array, and then calculate the interval sum from left to right in the num array, which can be obtained directly from ...
Added by DamianTV on Sun, 20 Feb 2022 20:03:37 +0200
Greedy algorithm ----- LeetCode 321 maximum number of splices
Title Description
Given two arrays of length m and N, the elements are composed of 0-9, representing the numbers on each bit of two natural numbers. Now select k (k < = m + n) numbers from the two arrays and splice them into a new number. The numbers taken from the same array are required to maintain their relative order in the origina ...
Added by sundru on Sun, 20 Feb 2022 19:15:15 +0200
[actual combat] valid parentheses of LeetCode illustrated by ACM players
Hello, everyone. I'm handsome.
Today, let's judge whether the brackets are valid.
I don't know what to say. Let's start the whole thing.
LeetCode 20: valid parentheses
meaning of the title
Given a string s that only includes' (',') ',' {','} ',' [','] ', judge whether the string is valid.
Examples
Input: s = "() [] {}"
Outpu ...
Added by ccx004 on Sun, 20 Feb 2022 09:42:30 +0200
leetcode—24. Heap Title leetcode summary
A center
The center of heap is dynamic extremum, which is indispensable.
1046. Weight of the last stone
There is a pile of stones, and the weight of each stone is a positive integer. Each round, choose the two heaviest stones and crush them together. Suppose the weight of the stone is x and Y respectively, and x < = y. Then ...
Added by liamloveslearning on Sun, 20 Feb 2022 06:55:04 +0200
Group B of JAVA University in the first game of the 12th Blue Bridge Cup 2021
Tip: This article has 6000 words, rough reading takes about 5 minutes and intensive reading takes about 30 minutes
viewpoint
This year's provincial tournament is a little different from the past. It pays more attention to mathematics, algorithms and ideas, and is a little closer to ACM. I believe this is a trend, and the future Blue Bri ...
Added by sella2009 on Sun, 20 Feb 2022 06:43:35 +0200
Finding the median of two positive arrays [difficult]
subject
Give two positively ordered (from small to large) arrays nums1 and nums2 of sizes m and n, respectively. Please find and return the median of these two positive arrays.
The time complexity of the algorithm should be O(log (m+n)).
Tips:
~~~~
num ...
Added by angus930 on Sat, 19 Feb 2022 17:21:24 +0200
Leetcode notes -- modification and construction of binary search tree in binary tree chapter
Catalogue of series articles
I Array type problem solving method 1: dichotomy II Array type problem solving method 2: Double finger needle method III Array type problem solving method 3: sliding window IV Array type problem solving method 4: simulation V The basic operation and classic topics of the linked list Vi Classic title of hash tab ...
Added by kb9yjg on Sat, 19 Feb 2022 13:43:47 +0200
LeetCode problem solution - dynamic programming - subsequence problem
LeetCode problem solution - dynamic programming - subsequence problem
Reference: labuladong WeChat official account, hand handle brush, dynamic programming series, official account, excellent public address, recommended to everyone.
In this paper, we will pick up the routine of sub sequence problem. In fact, there are two kinds of templ ...
Added by reversenorm on Sat, 19 Feb 2022 09:52:48 +0200
Java common class II
array
Arrays is a tool class that operates on arrays.
Common member methods
public static String toString(int[] a) //Convert array to string
public static void sort(int[] a) //Sort the array
public static int binarySearch(int[] a,int key) //Binary search
The toString() source code is as follows:
public static String toString(int[] a) {
...
Added by Cultureshock on Sat, 19 Feb 2022 01:06:59 +0200
LeetCode data structure and algorithm learning Day02
Title quoted from
https://leetcode-cn.com/
Graphic data structure and algorithm
Daily learning Day02 learning notes
20 numeric values represent strings
Title Description:
Please implement a function to judge whether the string represents a numeric value (including integer and decimal). The values (in order) can be divided into th ...
Added by WebMonkey on Fri, 18 Feb 2022 10:11:50 +0200