[Algorithm-LeetCode] 429.Hierarchical traversal of N-fork trees (N-fork trees; Hierarchical traversal; BFS)

429.N-Fork Tree Hierarchical Traversal-Force Button (LeetCode) Release: September 25, 2021 01:01:25 Problem description and examples Given an N-fork tree, returns the hierarchical traversal of its node values (that is, from left to right, traverse layer by layer). The serialized input to the tree is traversed in sequence, with each set of ...

Posted by joshblue on Fri, 24 Sep 2021 09:41:58 -0700

Leetcode 18 sum of four numbers

Problem description Give you an array of n integers, nums, and a target value, target. Please find and return the quads [nums[a], nums[b], nums[c], nums[d]]: 0 <= a, b, c, d < n a. b, c and d are different from each other nums[a] + nums[b] + nums[c] + nums[d] == target You can return answers in any order. Example 1: Input: num = [1 ...

Posted by therealchuckles on Fri, 24 Sep 2021 07:22:26 -0700

430. Flat multi-level bidirectional linked list

time September 24, 2021 subject In the multi-level bidirectional linked list, in addition to the pointer to the next node and the previous node, it also has a sub linked list pointer, which may point to a separate bidirectional linked list. These sub lists may also have one or more of their own sub items, and so on to generate multi-level da ...

Posted by kneifelspy on Fri, 24 Sep 2021 02:43:47 -0700

python | bidirectional linked list

brief introduction From: Easy to understand and explain linked list One way linked list: Bidirectional linked list: Look at the picture and understand... Bidirectional linked list data structure From: Data structure - bidirectional linked list (Python Implementation) Data structure has always been a very important part in the programm ...

Posted by dey.souvik007 on Fri, 24 Sep 2021 02:12:52 -0700

Force deduction question 10 regular expression matching (difficult)

Give you a string   s   And a character rule   p. Please implement a support '.'   and  '*'  Regular expression match for. '.' matches any single character '*' matches zero or more preceding elements The so-called matching is to cover   whole   character string   s, not part of the string. Example ...

Posted by Frapster on Fri, 24 Sep 2021 02:02:08 -0700

Algorithm problem solving (Leetcode 33, 34, 39, 42, 46)

33. Search rotation sort array - medium - 9 / 17 33. Search rotation sort array - medium The integer array nums is arranged in ascending order, and the values in the array are different from each other. Before passing to the function, Num rotates on a previously unknown subscript k (0 < = k < num.length), making the array [num [k], ...

Posted by F1Fan on Fri, 24 Sep 2021 00:47:47 -0700

LeetCode 88.Merge two ordered arrays Java

Title Description Give you two arrays of integers nums1 and nums2 in a non-decreasing order, with two integers m and n representing the number of elements in nums1 and nums2, respectively. Please merge nums2 to nums1 so that the merged arrays are also in a non-decreasing order. Note: Ultimately, the merged array should not be returned by a f ...

Posted by Hebbs on Thu, 23 Sep 2021 09:18:48 -0700

[small Y learning algorithm] ⚡ Daily LeetCode punch in ⚡ Table 3-39. Preorder traversal of binary tree

📢 preface 🚀 Algorithm problem 🚀 🌲 Punching out an algorithm problem every day is not only a learning process, but also a sharing process 😜🌲 Tip: the problem-solving programming languages in this column are C# and Java🌲 To maintain a state of learning every day, let's work together to become the great God of algorithm ...

Posted by Kev on Thu, 23 Sep 2021 07:54:04 -0700

leetcode brush record day009:28 and 8

28. Simple difficulty: passing rate 40% explain: What value should we return when need is an empty string? This is a good question in the interview. For this problem, we should return 0 when need is an empty string. This is consistent with the C language's str () and Java's indexOf() definitions. Question to charity: haystack and need are onl ...

Posted by cavemaneca on Thu, 23 Sep 2021 04:25:57 -0700

Force deduction question 4 find the median of two positive arrays

Give two positively ordered (from small to large) arrays of sizes m and n   nums1 and   nums2. Please find and return the median of these two positive arrays. Example 1: Input: nums1 = [1,3], nums2 = [2] Output: 2.00000 Explanation: merge array = [1,2,3], median 2 Example 2: Input: nums1 = [1,2], nums2 = [3,4] Output: 2.50000 Exp ...

Posted by joecrack on Tue, 21 Sep 2021 19:01:40 -0700