PTA: save 007 (upgraded) (30 points)

Title:   In the old movie "Live and Let Die", there is a plot in which 007 is caught by a drug dealer on an island in the center of an crocodile pool. He uses an extremely bold way to escape - directly stepping on the brain bags of a series of crocodiles in the pool and jumping ashore! (it is said that the stuntman was bitten by ...

Posted by heropage on Sun, 28 Nov 2021 10:37:26 -0800

Leetcode 5921. Maximize the path value anonymous function dfs or bfs with bitset in a graph

5921. Maximize the path value in a graph meaning of the title Here is an undirected graph with n nodes numbered from 0 to n - 1 (both included). At the same time, give you an integer array values with subscript starting from 0, where values[i] is the value of the ith node. At the same time, give you a two-dimensional integer array edges with su ...

Posted by balacay on Sun, 07 Nov 2021 13:56:59 -0800

Sword finger offer array topic summary (necessary for interview)

Sword finger offer array topic summary (C + + version)   1. Duplicate number in array All numbers in an array num of length n are in the range of 0 ~ n-1. Some numbers in the array are repeated, but I don't know how many numbers are repeated, or how many times each number is repeated. Find any duplicate number in the array. Idea 1: sort first ...

Posted by j115 on Thu, 04 Nov 2021 19:06:44 -0700

Codeforces Round #753 (Div. 3)

There are three main situations: It's been a second since I took a look at my beard. The implementation is also very simple. I write casually / too lazy to write After a second, I felt that it would not be realized, so I went to look at other people's code I didn't understand the question A Direct simulation. B Simple math problems + find rul ...

Posted by morris on Wed, 03 Nov 2021 17:48:13 -0700

[detailed algorithm solution] DFS solution force buckle 463 Island perimeter

subject A two-dimensional grid map grid of row x col is given, where grid[i][j] = 1 represents land and grid[i][j] = 0 represents water. The grids in the grid are connected horizontally and vertically (not diagonally). The whole grid is completely surrounded by water, but there happens to be an island (or an island connected by one or more gri ...

Posted by garty on Sat, 30 Oct 2021 16:28:29 -0700

[algorithm problem solving details] DFS solves the area surrounded by force buckle 130

subject Give you a matrix board of m x n, which consists of several characters' X 'and' O ', find all areas surrounded by' X ', and fill all' O 'in these areas with' X '. Example 1 Input: board = [["X","X","X","X"],["X","O","O","X"],["X","X","O","X"],["X","O","X","X"]] Output:[["X","X","X","X"],["X","X","X","X"],["X","X","X","X"],["X","O","X ...

Posted by sheffrem on Fri, 29 Oct 2021 07:49:35 -0700

Leetcode 785. Judgment bipartite graph (medium)

subject There is an undirected graph with n nodes. Each of these nodes has a unique number between 0 and n - 1. Give you a two-dimensional array graph, where graph[u] is an array of nodes, which is composed of adjacent nodes of node U. Formally, for each V in graph[u], there is an undirected edge between node u and node v. The undirected graph ...

Posted by proxydude on Fri, 15 Oct 2021 20:10:23 -0700