[case of algorithm thousand questions] daily LeetCode punch in - 96. The number of lines required to write a string
๐ข preface
๐ Algorithm problem ๐
๐ฒ Punching out an algorithm problem every day is not only a learning process, but also a sharing process ๐๐ฒ Tip: the problem-solving programming languages in this column are C# and Java๐ฒ To maintain a state of learning every day, let's work together to become the great God of algorithm ...
Posted by GoodWill on Mon, 27 Dec 2021 22:27:29 +0100
Summary of 1-200 brush questions with force deduction (3 / 5)
Symmetric array problem
Generally, the array problem with symmetry can be solved by forward traversal and reverse traversal, such as 162 peak elements and 135 distribution elements
Distribute candy
Use arrays Fill initializes all arrays to 1. During forward traversal, traverse the position from 1 to (n-1), and during reverse traversal, tra ...
Posted by it2051229 on Mon, 27 Dec 2021 08:10:03 +0100
leetcode question brushing diary-1044 Longest repeating substring
Title Description: Give you a string s and consider all its repeated substrings: that is, the continuous substrings of s appear 2 or more times in S. There may be overlap between these occurrences. Returns any repeating substring with the longest length. If s does not contain duplicate substrings, the answer is "".
...
Posted by vurentjie on Mon, 27 Dec 2021 08:00:47 +0100
leetcode-117. Populate Next Right Node Pointer II for Each Node
Given a Binary Tree
struct Node {
int val;
Node *left;
Node *right;
Node *next;
}
/*
// Definition for a Node.
class Node {
public int val;
public Node left;
public Node right;
public Node next;
public Node() {}
public Node(int _val) {
val = _val;
}
public Node(int _val, Node _left, Node ...
Posted by nuttynibbles on Mon, 27 Dec 2021 03:01:14 +0100
[case of algorithm thousand questions] daily LeetCode punch in - 97. The most common words
๐ข preface
๐ Algorithm problem ๐
๐ฒ Punching out an algorithm problem every day is not only a learning process, but also a sharing process ๐๐ฒ Tip: the problem-solving programming languages in this column are C# and Java๐ฒ To maintain a state of learning every day, let's work together to become the great God of algorithm ...
Posted by php_east on Sun, 26 Dec 2021 23:02:14 +0100
KMP (Knuth Morris Pratt) algorithm for string matching (illustration)
Longest prefix
Give a string ABA
Prefix set: {a, ab, aba, abab}
Suffix set: {a, ba, aba, baba}
The equal pre suffix is the set element marked with the same color above. The longest pre suffix is the longest of all equal pre suffixes, that is, the aba above. Take pictures for example: The prefix such as longest phase is the basis of K ...
Posted by decodv on Sun, 26 Dec 2021 17:58:35 +0100
Force buckle: 5965 Sum of intervals of the same elements - prefix and
Title:
Give you an array arr of n integers with subscripts starting from 0. The interval between two elements in arr is defined as the absolute difference between their subscripts. More formally, the interval between arr[i] and arr[j] is | i - j |. Returns an array of intervals of length n, where intervals[i] is the sum of the intervals bet ...
Posted by Parody on Sun, 26 Dec 2021 13:57:39 +0100
Introduction to leetcode 21 day dynamic planning -- climbing stairs from 0 to 0.5 [Day02]
Introduction to leetcode 21 day dynamic planning -- climbing stairs from 0 to 0.5 [Day02]
Write in front
Then in the last article, today Xiaofu ran up and down around the school built around the mountain, in order to eat shrimp dumplings with good taste. After all, today is the winter solstice. I hope all friends can also eat delicious dumpli ...
Posted by R0d Longfella on Sat, 25 Dec 2021 17:03:28 +0100
[force deduction time] [1154] [simple] the day of the year
Today's question is a little hard to say
1. Look at the questions
I'm a question The title was written in great detail, and the case s given were also very good. Some special situations were taken into account.
2. Examining questions
After reading the title, you should all smile. Ah? Right here, right here?
Is it a simple probl ...
Posted by durahman on Sat, 25 Dec 2021 02:19:39 +0100
LeetCode-056 consolidation interval
Merge interval
Title Description: an array of intervals is used to represent a set of several intervals, in which a single interval is intervals[i] = [starti, endi]. Please merge all overlapping intervals and return a non overlapping interval array, which needs to cover all the intervals in the input.
See LeetCode's official website for a ...
Posted by Serpent7 on Fri, 24 Dec 2021 23:24:54 +0100