Leetcode0797. All possible paths (medium, DFS)

1. Title Description Give you a directed acyclic graph (DAG) with # n # nodes. Please find all the paths from node # 0 # to node # n-1 # and output them (not in a specific order) graph[i] is a list of all nodes that can be accessed from node # I # (that is, there is a directed edge from node # I # to node # graph[i][j]). Example 1: Inpu ...

Posted by sanchez77 on Thu, 14 Apr 2022 03:17:22 +0300

I'll give you a pile of tasks to complete. Can you finish all the tasks on time?

I'll give you a pile of tasks to complete. Can you finish all the tasks on time? Tip: interview questions before Huawei 202204 It is similar to arranging meetings, waiting in line to finish washing, waiting in line to make coffee and other problems to test the skilled use of small root piles subject Give you an N*2 array arr, which re ...

Posted by neville on Wed, 13 Apr 2022 18:31:40 +0300

[brush questions] sword finger Offer

04. Find in 2D array Difficulty: medium In an n * m two-dimensional array, each row is sorted in ascending order from left to right, and each column is sorted in ascending order from top to bottom. Please complete an efficient function, input such a two-dimensional array and an integer, and judge whether the array contains the integer. ...

Posted by srdva59 on Wed, 13 Apr 2022 16:54:55 +0300

Learn the sequential storage and heap sorting of C/C + + series binary trees

Last time, I talked about what a tree is. In this article, I'll talk about what a binary tree is and how it should be implemented.   What is a binary tree Concept of binary tree Binary tree is a tree with a degree of 2 in practical and simple terms. That is, each node of the tree has at most two child nodes. The following figure clearly sh ...

Posted by Kibeth on Wed, 13 Apr 2022 14:32:39 +0300

[prepare for autumn move] easily grasp the high-frequency algorithm problem of big factory -- reverse linked list

🥪 Write in front Hello, friends 😋, I'm saury 🐟, A new blogger active in Java area and algorithm area~ Welcome to the algorithm learning community of colleges and universities 🏰: https://bbs.csdn.net/forums/Suanfa , the leaders in the community gather, and we exchange and learn from each other! From today on, I w ...

Posted by justsomeone on Wed, 13 Apr 2022 03:23:48 +0300

A collection of topics of bit operation series

theory See this chapter for the basic knowledge of bit operation Blog Examples leetcode765. Lovers holding hands N couples sit in 2N consecutive seats and want to hold each other's hand. Calculate the minimum number of seat exchanges so that each couple can sit side by side. You can choose any two people in one exchange and ask them to s ...

Posted by Saethyr on Tue, 12 Apr 2022 10:14:57 +0300

[question brushing diary] classic questions must be brushed for the introduction of C + +

😀 Hello, I'm Bai Chen. I'm not very able to stay up late 😫, But people who want to get better ✈. If you like this article, give it a compliment 👍, Pay attention 👀 Bai Chen! Your support is my biggest motivation! 💪💪💪 🏹 preface Bai Chen reviewed my C + + learning journey during this period and found many bumps and difficulti ...

Posted by carrot on Tue, 12 Apr 2022 05:18:24 +0300

Letter combination of telephone number

Title Description Given a string containing only the numbers , 2-9 , returns all the letter combinations it can represent. The answers can be returned in any order. The mapping of numbers to letters is given as follows (the same as telephone keys). Note that 1 does not correspond to any letter. Example 1: Input: digits = "23&quot ...

Posted by smoked1 on Mon, 11 Apr 2022 08:29:23 +0300

Longest return text string

1, Demand Give you a string , s , and find the longest palindrome substring in , s ,. Example 1: Input: s = "babad" Output:"bab" Explanation:"aba" The same answer is in line with the meaning of the question. Tips: 1 <= s.length <= 1000s # consists only of numbers and English letters (uppercase and / or lowercase) 2, Violence ...

Posted by benjudy on Sun, 10 Apr 2022 21:48:15 +0300

Several topics of recursive backtracking

I feel that the ideas of these backtracking topics are quite simple. Put a simple template if (get a solution) { Save answer return } If (unable to get solution) { return } if (data available) { Store data Recursively execute the next layer Pop up the data just saved Recursively execute the next layer } combination Given two integers n and k ...

Posted by tuneout on Sun, 10 Apr 2022 17:46:25 +0300