The first question of LeetCode brushing questions, the use of the sum of two numbers and the hash table
Topic description
Given an integer array nums and a target value target, please find the two integers in the array whose sum is the target value, and return their array indices.
You can assume that there will only be one answer for each input ...

Posted by 8ta8ta on Tue, 24 May 2022 17:54:50 +0300

1, Topic analysis
(1) The problem can be abstracted as detecting whether a directed graph has a ring. If yes, return False; If not, return True.
(2) For a directed graph, we can delete nodes with zero penetration one by one. For each deleted node, the connected directed line segment will also be deleted (i.e. the penetration of this point as ...

Posted by judgy on Tue, 24 May 2022 11:48:30 +0300

130. Surrounding areas
Title Source: LeetCode https://leetcode-cn.com/problems/surrounded-regions
subject
Given a two-dimensional matrix containing 'X' and 'o' (letter O).
Find all areas surrounded by 'X' and fill all 'O' in these areas with 'X'.
Example:
X X X X
X O O X
X X O X
X O X X
After running your function, the matrix becomes:
X X X X
X ...

In dynamic programming, the right class of problems is derived from the knapsack problem. Its core is to give an array nums[i] and select some data from nums[i] according to some requirements to meet some requirements
More subdivision is whether the elements in a pile of sets can be taken repeatedly. Then someone on the Internet raised the q ...

Posted by corrupshun on Tue, 24 May 2022 08:27:05 +0300

Leetcode79 medium\color{#FF4500}{medium}medium
Click to enter the original question link: Word Search
Related topics: word search II word search II
[tag] backtracking search, C++ ASCII
subject
Discription
Given a 2D board and a word, find if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell ...

Posted by snaack on Tue, 24 May 2022 01:57:25 +0300

Backtracking algorithm framework
Backtracking is closely related to DFS.
Backtracking means "withdraw one step"
Solving a backtracking problem is actually a traversal process of decision tree. Just think about three questions:
Path: choices already made;
Selection list: currently available selections;
End condition: a condition tha ...

Posted by BizLab on Mon, 23 May 2022 11:25:19 +0300

Analysis and java implementation of search related topics in binary tree in Leetcode
In fact, there are some miscellaneous problems in this category. It is basically to find some or a specific value in the binary tree. There are many problems. We will summarize them through two or three articles, but generally speaking, it is basically BFS, whi ...

Posted by HavokDelta6 on Mon, 23 May 2022 10:13:08 +0300

Leetcode Best Time to Buy and Sell Stock series topic analysis and java implementation
The title of this series is to allow us to trade according to restrictions in a continuous period of stock prices to maximize profits. Each derivative title will set some restrictions
Best Time to Buy and Sell Stock I
Best Time to Buy and Sell Stock II
Best ...

Posted by Karlos2394 on Sun, 22 May 2022 21:32:50 +0300

Common dynamic programming problems (2)
This article is reproduced at GitHub address: https://github.com/CyC2018/CS-Notes/ , only for personal review in the future. Integrated various data, invasion and deletion.
Citation analysis:
Content from official account article: https://mp.weixin.qq.com/s/lKQI0aS1MBwfPujC-m_zkA
Use the dynamic ...

Posted by h123z on Sun, 22 May 2022 21:13:49 +0300

Three minutes a day, embark on the counter attack of the algorithm.
Previous collection
A daily LeetCode collection
Code warehouse
GitHub: https://github.com/meteor1993/LeetCode
Gitee: https://gitee.com/inwsy/LeetCode
Title: merging two ordered arrays
Title Source: https://leetcode-cn.com/problems/merge-sorted-array/
Here are two ordered i ...

Posted by abselect on Sun, 22 May 2022 11:29:12 +0300