[sword finger Offer] mathematics
Sword finger Offer 14- I. cut rope
Here is a rope with length n. please cut the rope into m segments of integer length (M and N are integers, n > 1 and M > 1). The length of each segment of rope is recorded as k[0],k[1]...k[m-1]. What is the possible maximum product of k[0]*k[1]*...*k[m-1]? For example, when the length of the rope is 8, ...
Posted by husslela03 on Sat, 02 Oct 2021 15:42:16 -0700
This blog is about stack in LeetCode I wrote
Question 1 (corresponding to question 20 of LeetCode question bank) (simple question!)
(of course, if you don't understand your own summary, you can go to the website and read the corresponding topic to see the solution!)
Title: valid parentheses (parenthesis matching problem of string)
(I wrote a hundred lines at the first time, but I could ...
Posted by jeroom on Sat, 02 Oct 2021 13:12:27 -0700
LeetCode 15 sum of three numbers
LeetCode 15 sum of three numbers
Title Description
Give you an array num containing n integers. Judge whether there are three elements a, b and c in num, so that a + b + c = 0? Please find all triples with sum 0 and no repetition. OJ link
Train of thought analysis
First, special cases shall be handled
If the array is empty, an empty c ...
Posted by zander213 on Thu, 30 Sep 2021 12:18:43 -0700
Double pointer topic summary
(Kago double pointer chapter punch in)
1. Remove element
thinking
It can be solved directly. But the time complexity will be very large. A simpler way is to speed the pointer. The idea of this fast and slow pointer is that the slow pointer points to the position of the inserted character (treat the array as a new array), and the fast poi ...
Posted by markuatcm on Thu, 30 Sep 2021 11:55:40 -0700
[Small Y algorithm]⚡Daily LeetCode clock-in⚡- 45. Most elements
📢Preface
🚀 Algorithmic problems🚀
🌲 Typing an algorithmic problem every day is both a learning process and a sharing process😜🌲 Tip: This column uses both C#and Java for problem solving programming languages🌲 To keep learning every day, let's work together to become the algorithmic God🧐!🌲 Today is the 45th day of punch-in ...
Posted by Hokus on Thu, 30 Sep 2021 09:11:03 -0700
Huawei machine test online training | problem solving record | HJ01-103
0. Basic knowledge
0.1. Input and output
0.1.1 basic input and output
Input normal
int n;
cin>>n;
cout<<n;
Enter with spaces
string str;
cin(cin,str);
0.1.2 header file
Common header file
#include<bits/stdc++.h>
using namespace std;
0.2. Common operations on strings
substr
string str='123';
string temp=str.s ...
Posted by Greg_BigPhpAmat on Wed, 29 Sep 2021 21:17:20 -0700
[Small Y algorithm]⚡Daily LeetCode clock-in⚡- 43.Sum of Two Numbers II - Input Ordered Array
📢Preface
🚀 Algorithmic problems🚀
🌲 Typing an algorithmic problem every day is both a learning process and a sharing process😜🌲 Tip: This column uses both C#and Java for problem solving programming languages🌲 To keep learning every day, let's work together to become the algorithmic God🧐!🌲 Today is the 43rd day of punch-in ...
Posted by Nhoj on Tue, 28 Sep 2021 09:10:40 -0700
Algorithm learning: 1-1 greedy algorithm
The so-called greedy algorithm is to ensure that each operation is a local optimal solution, so that the final result is a global optimal solution.
Exercise 1:455. Distribute cookies The key to using greedy algorithm is to find greedy strategy, that is, each operation is a local optimal solution.
As can be seen from the question, to satisf ...
Posted by Pastulio on Mon, 27 Sep 2021 06:37:57 -0700
LeetCode 416. Segmentation and subsets
So far, I have written more than 600 algorithm problems, some of which have been sorted into pdf documents. At present, there are more than 1000 pages (and will continue to increase), which can be downloaded for free Download link: https://pan.baidu.com/s/1hjwK0ZeRxYGB8lIkbKuQgQ Extraction code: 6666
We talked about it earlier 520, backtrac ...
Posted by Desertwar on Sun, 26 Sep 2021 18:18:18 -0700
Iterative Postorder Traversals of Binary Tree
Non recursive postorder traversal of binary tree
1. Using 1 stack
O(n) time, O(n) space The initial setting stack is empty, and the current node is the root node
Perform the following operations until the stack is empty and the current node is empty:
Stack the current node and set the left child as the current node until the current node is ...
Posted by Michael_zz on Sat, 25 Sep 2021 04:12:40 -0700