LeetCode -- string (python language)
LeetCode -- string (python language)
1, String
1.1 string definition
A string is a concatenation of a series of characters. The string can be traversed, and each traversal is a character.
1.2 string matching
First, we call the string to be matched (long) as the main string, and the string to be matched (short) as the sub string (pattern st ...
Posted by deadimp on Sat, 05 Mar 2022 11:50:54 +0100
Ordering problem (classic 0-1 backpack)
subject
describe
Peking University network laboratory often needs to order takeout for activities, but the maximum amount of reimbursement for each order is C yuan. There are N kinds of dishes to order. After ordering for a long time, the network laboratory has a quantitative evaluation score for each dish i (indicating the palatability of th ...
Posted by mbh23 on Sat, 05 Mar 2022 09:09:04 +0100
Priority queue (maximum and minimum heap) summary
preface
It mainly describes how to construct the maximum and minimum heap through priority queue to solve the topK problem.
1, Priority queue
1. The priority queue looks like a queue, and the bottom layer is implemented based on heap. 2. Priority queue can arrange the queued elements to their own positions according to the priority b ...
Posted by davestewart on Sat, 05 Mar 2022 09:07:42 +0100
PAT grade B experience (under update)
1002 write this number
c + + number and string conversion
Method 1: use stringstream: add header file #include
Number to string #include <string>
#include <sstream>
int main(){
double a = 123.32;
string res;
stringstream ss; //Define stream ss
ss << a; //Convert number a to stream ...
Posted by neverett on Sat, 05 Mar 2022 06:14:38 +0100
[daily real topic, preparing for blue bridge Java] straight line + path
Written at the beginning: The Blue Bridge Cup is coming. The countdown is 36 days! Do (learn the real problem + understand the real problem + be able to do the real problem + summarize the real problem) While (time! = 0) April showers bring May flowers. Strive to rush out of the provincial competition, come on!
Today, we bring the personal s ...
Posted by RottenBananas on Sat, 05 Mar 2022 04:13:15 +0100
Algorithm exercise 38 --- Blue Bridge Cup 2018 provincial competition "global warming"
preface
Blue Bridge Cup 2018 provincial competition, programming problem (C + +)
This topic examines the application of DFS algorithm
1, Title Description
You have a picture of NxN pixels of a certain sea area, "." represents the ocean, "#" represents the land, as shown below:
.......
.##....
.##....
....##.
...
Posted by dickey on Sat, 05 Mar 2022 02:54:19 +0100
Data structure and algorithm linear table
Linear table
Definition of linear table:
A finite sequence consisting of n(n ≥ 0) data elements (a1,a2,..., an).Record as: L=(a1,a2,..., an) ai-1 is the direct precursor of ai, and ai+1 is the direct successor of ai a1 - first element - it has no precursor an -- tail element - it has no successorTable length: the number of elements in a li ...
Posted by Bobulous on Sat, 05 Mar 2022 01:22:48 +0100
Exercise 6-7 simple calculator (super detailed! Structured programming step analysis) (20 points)
Exercise 6-7 simple calculator (20 points)
Simulate the operation of a simple arithmetic unit. Assuming that the calculator can only perform addition, subtraction, multiplication and division, and the operands and results are integers, the four operators have the same priority and are calculated from left to right.
Input format:
Input gives ...
Posted by MikeSpider on Fri, 04 Mar 2022 23:49:14 +0100
Solution to 45 A-E questions of Niuke monthly competition
preface
link Niuke Xiaobai monthly race 45
Finish five questions for the first time hh
Try to write a solution
The codes are directly copy the game time codes, which may be messy
I'll try to write notes hh If you have any questions, please point them out hh
A
This problem is difficult to read...
If n > = x Then you can jump horizont ...
Posted by jameslynns on Fri, 04 Mar 2022 22:52:21 +0100
On virtue and talent of Java algorithm
Title Description
Sima Guang, a historian of the Song Dynasty, has a famous "theory of virtue and talent" in his "Zizhi Tongjian": "therefore, the perfection of talent and virtue is called a saint, the death of talent and virtue is called a fool, the victory of virtue is called a gentleman, and the victory of virtu ...
Posted by silas101 on Fri, 04 Mar 2022 21:09:30 +0100