Leetcode (special topic of graph theory)
1. Introduction
Graph: directed graph and undirected graphProblem solving steps:
(1) Drawing construction: what kind of drawing and how to build it (2) Then, specific problems are analyzed, such as using BFS and greedy algorithm to operate the graph
Joint search set
//Parallel query set (manage a series of sets that do not want to ...
Posted by jtjohnson260 on Fri, 17 Dec 2021 16:17:58 +0100
LeetCode brush notes binary search boundary contraction
Boundary value of binary search
Binary search is very simple, but it also has its difficulties. The difficulty lies in the selection of judgment conditions and boundary values, which can easily lead to boundary crossing or dead cycle.
For the judgment condition of the loop, if the search interval is a closed interval [left, right], the judgme ...
Posted by $kevan on Fri, 17 Dec 2021 14:47:04 +0100
Complete solution to the curriculum problem [implemented in pure C language]
The four questions here have different ideas:
The first two are topological sorting. The concept of penetration is used to judge whether there are rings in the graph. Queue and stack are used respectively.When creating a graph, you can use dynamic capacity expansion to build a data structure similar to the adjacency tableThe third problem uses ...
Posted by cjconnor24 on Fri, 17 Dec 2021 07:50:18 +0100
LeetCode Zero Foundation Guide (Lecture 8) Two-dimensional Array - Java
I. 1351. Negative Numbers in Statistically Ordered Matrix
1. Title
1351. Negative numbers in statistical ordered matrices
Give you a matrix grid of m * n whose elements are arranged in a non-increasing order, either by row or by column. Please count and return the number of negative numbers in the grid.
2. Analysis
The title has ...
Posted by cubik on Thu, 16 Dec 2021 19:00:37 +0100
Algorithm learning 1-1 linked list learning pen
Linked list
Definition of linked list
n nodes are linked into a linked list, which is the linked storage structure of linear list. Because each node of this linked list contains only one pointer field, it is called single linked list.
1. Characteristics of linked list
Linked list is not suitable for fast positioning data, and is suitab ...
Posted by alluoshi on Thu, 16 Dec 2021 15:11:33 +0100
LeetCode zero foundation guide (Lecture 8) two dimensional array
โ preface โ
Today is the seventh day of the nine day training. I will record the learning contents and problem solutions and strive to be the class representative 0.0 Link: LeetCode zero foundation guide (Lecture 8) two dimensional array
๐ง๐ป About the author: a young man who changed from industrial design to embedded โจ Contact: 2201891 ...
Posted by phpnewb999 on Thu, 16 Dec 2021 06:43:44 +0100
LeetCode primary algorithm - array
Primary algorithm
1, Remove duplicates from sort array
Title: give you an ordered array nums. Please delete the repeated elements in place, so that each element appears only once, and return the new length of the deleted array.
Do not use additional array space. You must modify the input array in place and complete it with O(1) additional sp ...
Posted by helloise on Thu, 16 Dec 2021 05:35:49 +0100
155. Minimum stack force buckle (LeetCode)
55. Minimum stack force buckle (LeetCode)
๐155. Minimum stack force buckle (LeetCode)
Topic Description: design push, pop, top and getMin functions, and find the minimum value when the time complexity is O(1) Wrong idea: given a variable to record the minimum value, this idea is wrong, and we should consider the problem more comprehensi ...
Posted by latinofever on Wed, 15 Dec 2021 21:03:11 +0100
LeetCode 807. Maintain urban skyline / 630 Schedule III (greed + priority queue) / 851. Noisy and rich (topological sorting)
807. Maintain the urban skyline
2021.12. 13 one question per day
Title Description
Give you a city composed of N x n blocks, each block contains a cube building. Give you an n x n integer matrix grid with subscript starting from 0, where grid[r][c] represents the height of the building located in row r and column c.
The skyline of a city is ...
Posted by mhodge87 on Wed, 15 Dec 2021 19:48:07 +0100
Leetcode042 connected to rainwater &039 histogram maximum rectangular area
The maximum rectangular area of rainwater and histogram are two problems that echo each other. There are many similarities in principle, but there are differences in details.
Connected to rainwater (monotonous stack)
Brute force method (double pointer):
Note that after finding the highest column on the left and right sides, it is also ne ...
Posted by cloudnyn3 on Wed, 15 Dec 2021 16:56:50 +0100