## Several sorting methods of arrays

Quick sort
Quick sorting embodies the idea of divide and conquer. Determine the final position of a number each time, place it in the correct position, and then quickly sort the arrays at both ends in the same way through recursion.
It should be noted that when using quick sort, the decision number needs to be taken randomly, which is called ...

Posted by **ferronrsmith** on *Thu, 10 Mar 2022 17:33:18 +0100*

## leetcode -- string to integer (atoi)

subject
Please implement a myAtoi(string s) function to convert the string into a 32-bit signed integer (similar to the atoi function in C/C + +).
The algorithm of the function myAtoi(string s) is as follows:
Read in the string and discard useless leading spacesCheck whether the next character (assuming it is not at the end of the character) ...

Posted by **agnaldovb** on *Wed, 09 Mar 2022 10:09:35 +0100*

## Preorder traversal of leetcode 144 binary tree

Preorder traversal of binary tree
Title Description
Give you the root node of the binary tree, root, and return the preorder traversal of its node value.
Example 1:
Input: root = [1,null,2,3]
Output:[1,2,3]
Example 2:
Input: root = []
Output:[]
Example 3:
Input: root = [1]
Output:[1]
Method 1: recursion
For tree traversal, recursive method ...

Posted by **Kaizard** on *Wed, 09 Mar 2022 08:42:32 +0100*

## Li Kou Learning + previous life files

Plates between candles
Here is a long table with plates and candles lined up on it. Give you a string s with subscript starting from 0. It only contains the characters' * 'and' | ', where' * 'represents a plate and' | 'represents a candle.
At the same time, give you a two-dimensional integer array queries with subscript starting from 0, where ...

Posted by **lucerias** on *Tue, 08 Mar 2022 15:42:36 +0100*

## 2055. Plates between candles / 54 Spiral matrix / 59 Spiral matrix II

2055. Plates between candles [medium] [daily]
Idea:
Record the number of plates in front of each position with cnt; Use left to record the position of the first candle on the left of the current position; Use right to record the position of the first candle on the right of the current position.Traverse each query, and define x as the posit ...

Posted by **Schlo_50** on *Tue, 08 Mar 2022 10:11:25 +0100*

## LeetCode 2055. The plate before the candle

subject
2055. Plates between candles
Method 1: dichotomy + prefix and
Algorithm flow:
Data preprocessing: scan the string s from front to back, record the candle subscript in the array list (the array is strictly incremented - binary basis), and preprocess the prefix and array of the plateTraverse queries:
For any query
...

Posted by **chokies12** on *Tue, 08 Mar 2022 09:29:59 +0100*

## 1329. Sort the matrix diagonally

Address:
Force bucklehttps://leetcode-cn.com/problems/sort-the-matrix-diagonally/
Title:
A matrix diagonal is a diagonal line starting from an element in the topmost row or leftmost column of the matrix, along the lower right direction to the end of the matrix. For example, the matrix mat has 6 rows and 3 columns. The diagonal of the matrix ...

Posted by **ferdi** on *Tue, 08 Mar 2022 09:11:44 +0100*

## [rookie training] 714 The best time to buy and sell stocks includes handling charges

Title Description:
Given an integer array prices, where the i-th element represents the stock price on the i-th day; The nonnegative integer fee represents the handling fee for trading stocks. You can complete transactions indefinitely, but you need to pay a handling fee for each transaction. If you have bought a stock, you can't continue to b ...

Posted by **ruddyu78** on *Tue, 08 Mar 2022 00:22:25 +0100*

## Algorithm Title: regular expression matching (title + idea + code + comment)

subject
Regular Expression Matching Give you a string s and a character rule p, please implement a support '.' Matches the regular expression of '*'.
‘.’ Match any single character '*' matches zero or more preceding elements The so-called matching is to cover the whole string s, not part of the string.
Example 1:
Input: s = &q ...

Posted by **Robert Plank** on *Mon, 07 Mar 2022 19:20:41 +0100*

## String correlation function

String correlation functions and methods
Correlation functions: len, str, eval
1. Str (data) - convert the specified data into a string (when converting, put quotation marks directly outside the printed value of the data)
str(100) #'100'
str(True) #'True'
list1 = [10,20,30]
str(list1) #'[10, 20, 30]'
2. Eval (string) - evaluates th ...

Posted by **richza** on *Mon, 07 Mar 2022 02:40:24 +0100*