Codeforces Round #769 (Div. 2) A -D
https://codeforces.com/contest/1632
A
If there is a palindrome substring in a string whose length is greater than 1, NO is output; otherwise, YES is outputViolence can be done, but there is a better idea. Note that this is a 01 string. If the length is greater than 2, there must be such a palindrome string, because both 001 and 010 meet this ...
Posted by vMan on Thu, 03 Feb 2022 07:28:24 +0100
MEX Sequences (state machine DP)
MEX Sequences
[Link](Problem - D - Codeforces)
meaning of the title
Give you a sequence
x
n
x_n
xn, how many subsequences do you satisfy
∣
x
...
Posted by Stressed on Thu, 03 Feb 2022 07:04:39 +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
Tree chain subdivision and heuristic merging on tree
1, Tree chain subdivision
Idea: transform the problem on the tree into line segment, maintain it on the tree, and turn it into sequence on the tree
1. Heavy chain subdivision
Significance: heavy chain subdivision can divide any path on the tree into no more than
O
(
...
Posted by jingcleovil on Thu, 03 Feb 2022 05:41:56 +0100
Two way search summary
Bidirectional search
1, Bidirectional search
When the start state and end state are given, the efficiency will be very low and the search tree will be very large if you use ordinary search to search from the start to the bottom;
Therefore, you can use two-way search and search from the starting point and the end point to the middle at the sa ...
Posted by jpt62089 on Thu, 03 Feb 2022 02:13:09 +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
Detailed analysis of the top ten sorting algorithms (js Implementation)
Algorithm overview
Ten common sorting algorithms can be divided into two categories:
Comparison sort: the relative order between elements is determined by comparison. Because its time complexity cannot exceed O(nlogn), it is also called nonlinear time comparison sort.
Non comparison sort: the relative order between elements is no ...
Posted by Jon12345 on Thu, 03 Feb 2022 01:06:47 +0100
Java Basics (12) - sorting and finding
catalogue
1, Bubble sorting
thought
code implementation
example
2, Select sort
Sorting thought
code implementation
Example: sort the array {21,54,21,2,4,87,24,82,4,5}
3, Quick sort
Sorting thought
code implementation
Instance to quickly sort the array {21,54,21,2,4,87,24,82,4,5}
4, Binary search
Algorithmic thought
code impleme ...
Posted by CanWeb on Thu, 03 Feb 2022 00:26:58 +0100
Thinking analysis of dynamic programming problem in algorithmic interview
I wish you all good health and happiness in the new year. According to the observation and experience in the past decades, congratulations alone can't make people rich. Only when we successfully find a good job and win a satisfactory career can we have the opportunity to make money. Being able to enter a good enterprise is naturally a reasonabl ...
Posted by bluns on Wed, 02 Feb 2022 20:09:27 +0100