Algorithm training JAM counting method java problem solving

Resource constraints Time limit: 1.0s   Memory limit: 256.0MB Problem description Jam is a science freak who likes to be unconventional. Instead of counting with Arabic numerals, he used lowercase English letters. He felt that doing so would make the world more colorful. In his counting method, the number of digits of each number is th ...

Posted on Fri, 03 Dec 2021 21:38:55 -0500 by freshrod

LeetCode selected TOP interview question 230. The K-smallest element in the binary search tree

Title Description Given the root node of a binary search tree, root, and an integer kDesign an algorithm to find the k-th smallest element (counting from 1). example input : root = [3,1,4,null,2], k = 1 output : 1 note : 3 / \ 1 4 \ 2 input : root = [5,3,6,2,4,null,null,1], k = 3 output : 3 ...

Posted on Mon, 29 Nov 2021 12:23:29 -0500 by Brendan

[detailed solution of algorithm problem] DFS solution force buckle the maximum area of 695 Islands

subject Give you a binary matrix grid of size m x n. An island is a combination of some adjacent 1s (representing land). The "adjacent" here requires that two 1s must be adjacent in four horizontal or vertical directions. You can assume that the four edges of the grid are surrounded by 0 (representing water). The area of an island ...

Posted on Sun, 31 Oct 2021 19:31:05 -0400 by barrylee

Educational Codeforces Round 108 (Rated for Div. 2) E. Off by One

1, General idea of the topic Give you n points. Each point can and must be displaced once (move one unit horizontally to the right or move one unit vertically upward). Ask how many pairs of points can be matched after displacement (as long as two points are collinear with the origin, three points can be matched). Each point can only be matched ...

Posted on Thu, 21 Oct 2021 16:53:52 -0400 by heldenbrau

Leetcode 695. Maximum area of the island

subject Give you a binary matrix grid of size m x n. An island is a combination of some adjacent 1s (representing land). The "adjacent" here requires that two 1s must be adjacent in four horizontal or vertical directions. You can assume that the four edges of the grid are surrounded by 0 (representing water). The area of an island ...

Posted on Wed, 13 Oct 2021 13:19:31 -0400 by $0.05$

Leetcode547. Number of provinces (medium)

subject Problem solution n cities and the connection relationship between them can be regarded as a graph. The city is the node in the graph, and the connection relationship is the edge in the graph. The given matrix isConnected is the adjacency matrix of the graph, and the province is the connected component in the graph. Calculating the ...

Posted on Sat, 09 Oct 2021 00:46:33 -0400 by DESIGNGRAPHY

[luogu U137467] flying chess (dfs) (search pruning)

Flight chess Title Link: luogu U137467 General idea of the topic Give you an n*m grid, and then there are some numbers with 1~k on it. Then you have to fill the grid with a number of 1~k, and ask how many filling schemes you have. No path from top left to bottom right passes through the same number. Then define that these paths can only go t ...

Posted on Wed, 29 Sep 2021 15:19:37 -0400 by scooter41