Codeforces Round #753 (Div.3) A~D problem solution
Codeforces Round #753 (Div.3) A~D problem solution
A. Linear Keyboard
meaning of the title
Given a keyboard composed of 26 lowercase letters in a certain order, each group gives a word, and calculates the distance that the hand moves to complete the word.
thinking
First, create two strings a and s to store the keyboard and words respective ...
Posted by willeadie on Fri, 04 Feb 2022 05:25:56 +0100
Fundamentals of Python: data structure of Python
brief introduction
Whether doing scientific calculation or writing applications, we need to use some basic data structures, such as lists, tuples, dictionaries and so on.
This article will explain these basic data structures in Python in detail.
list
A list is a list, which can be expressed in square brackets:
In [40]: ages = [ 10, 14, 18, ...
Posted by robertvideo on Fri, 04 Feb 2022 04:27:00 +0100
Basic operation of binary tree and related problems
[preface]
Recently, I reviewed the exercises related to binary tree and shared some basic exercises according to the courseware
Tree is the top priority in data structure, especially the basic problems of various binary trees. I hope to deeply understand binary trees by summarizing the basic problems of binary trees.
[introduction to bin ...
Posted by tony_l on Thu, 03 Feb 2022 11:23:56 +0100
0x14 content introduction and example exercises
Hash string
Here we mainly introduce string hashing, which is a violent algorithm. When we are dealing with string type problems, if we don't have ideas, we might as well try hashing. String hash in
O
(
n
)
...
Posted by All4172 on Thu, 03 Feb 2022 08:41:30 +0100
JavaScript implementation prefix tree
brief introduction
Prefix tree is also called word lookup tree, Trie tree , is a kind of tree structure , is a variant of hash tree. The typical application is to count, sort and save a large number of data character String (but not limited to string), so it is often used by search engine system for text word frequency statistics. Its advantag ...
Posted by All4172 on Thu, 03 Feb 2022 08:25:55 +0100
Data structure and algorithm -- reverse pair in array
Title: two numbers in the array. If a signature number is greater than the following array, the two numbers form a reverse order pair. Enter an array and find the total number of reverse pairs in this array. Case: in the input array {7,5,6,4}, there are five pairs in reverse order, namely {7,6}, {7,5}, {7,4}, {6,4}, {5,4} As described above, ...
Posted by dacs on Thu, 03 Feb 2022 06:50:10 +0100
Prepare for the second test, three questions a day, Day26
Prepare for the second test, three questions a day
Topic 1: square root of x
Give you a nonnegative integer x, calculate and return the arithmetic square root of X.
Since the return type is an integer, only the integer part will be retained and the decimal part will be rounded off.
Note: it is not allowed to use any built-in exponential fun ...
Posted by orion2004 on Thu, 03 Feb 2022 06:45:36 +0100
python bidirectional linked list and bidirectional circular linked list
I hope to take notes to record what I have learned, and I hope it can help the same beginner. I also hope that the big guys can help correct the error ~ infringement legislation and deletion.
catalogue
1, Concepts of bidirectional linked list and bidirectional circular linked list
2, Implementation of bidirectional linked list
1. Create nod ...
Posted by speps on Thu, 03 Feb 2022 02:25:08 +0100
Area covered by (HDU - 1255) (scan line)
Given several rectangles on the plane, find the area of the area covered by these rectangles at least twice
Input
Lower left and upper right coordinates The first line of input data is a positive integer t (1 < = T < = 100), representing the number of test data The first row of each test data is a positive integer N (1 < = N < ...
Posted by wherertheskips on Thu, 03 Feb 2022 02:01:39 +0100
Sum tree array in reverse order
one. Problem description
Find all the reverse order pairs of a given array. The reverse order pair means that a pair of elements in the array satisfy that the value of the left element is greater than that of the right element
two. Examples
Example 1:
Input: [9,1,0,5,4] Output: 6
3. Analysis
Tree array Tree array is a ...
Posted by milsaw on Thu, 03 Feb 2022 01:54:28 +0100