In-depth Analysis of Data Structure and Algorithms Solving Ideas and Algorithmic Examples of Disturbing Strings

1. Title requirements Using the algorithm described below, you can scramble the string s to get the string t: If the length of the string is 1, the algorithm stops. If the length of the string is > 1, perform the following steps: Split a string into two non-empty substrings at a random subscript. That is, if the string s is ...

Added by phbock on Fri, 11 Feb 2022 20:21:41 +0200

leetcode 93. Recover IP address [backtracking]

1. Subject requirements leetcode 93. Restore IP address The valid IP address consists of exactly four integers (each integer is between 0 and 255 and cannot contain leading 0). Use '.' between integers separate. For example, "0.1.2.201" and "192.168.1.1" are valid IP addresses, but "0.011.255.245", "192.16 ...

Added by fiddler80 on Fri, 11 Feb 2022 18:23:59 +0200

Sum of two lecodes II-167

Give you an integer array numbers with subscript starting from 1. The array has been arranged in non decreasing order. Please find two numbers in the array that meet the sum of addition and equal to the target number target. If the two numbers are numbers[index1] and numbers[index2] respectively, then 1 < = index1 < index2 < = numbers ...

Added by laradg on Fri, 11 Feb 2022 10:19:41 +0200

LeetCode question brushing - Summary of sword finger offer stack and queue questions

Sword finger Offer 09 Queue with two stacks subject Implement a queue with two stacks. The declaration of the queue is as follows. Please implement its two functions appendTail and deleteHead to insert integers at the end of the queue and delete integers at the head of the queue respectively. (if there are no elements in the queue, the del ...

Added by likwidmonster on Fri, 11 Feb 2022 07:33:24 +0200

Search algorithms DFS, BFS, backtracking

Deep search Deep search DFS. When a new node is found, it will immediately traverse the new node. It needs to use stack implementation or recursive implementation equivalent to stack. If the parent node of the traversal loop has a different record, it can also be used to detect each parent node. Sometimes we may need to mark the nodes ...

Added by meltingpotclub on Fri, 11 Feb 2022 07:32:19 +0200

[Blue Lake special session] the 241st weekly match of Li Kou

I went to bed late last night. I went to bed at 4 o'clock and got up at 10 o'clock to play the game Question 1: 5759 Find the XOR sum of all subsets and then sum Title Link 5759. Find the XOR sum of all subsets and sum again Topic introduction Topic idea Directly find the number of subsets, and then XOR each subset, and finally su ...

Added by pavanpuligandla on Thu, 10 Feb 2022 22:59:49 +0200

[daily practice of Android spring moves] LeetCode Hot 5 questions + design mode

overview LeetCode Hot: Full Permutation, rotating image, letter ectopic word grouping, maximum subarray and, jumping game Design mode: adapter mode, decorator mode, agent mode, command mode and observer mode LeetCode Hot 2.21 full arrangement Given an array nums without duplicate numbers, all possible permutations are returned. You can ...

Added by dfownz on Thu, 10 Feb 2022 20:51:13 +0200

Leecode421: Maximum XOR value of two numbers in an array

Give you an array of integers, nums, and return the maximum result of nums[i] XOR nums[j]. Where 0<=i<=j<n Tips: 1 <= nums.length <= 2 * 104 0 <= nums[i] <= 231 - 1 Example 1: Input: nums = [3,10,5,25,2,8] Output: 28 Interpretation: The maximum result of the operation is 5 XOR 25 = 28. Example 2: Input: nums = ...

Added by hansman on Thu, 10 Feb 2022 14:21:13 +0200

Dynamic programming 3: continuous subarray class problem

Current topic 53. Maximum subarray and 918. Maximum sum of circular subarrays 152. Product maximum subarray 1567. Longest subarray length with positive product 53. Maximum subarray and The common feature of several topics in this issue is to find a continuous array in an array to maximize the goal. We start wit ...

Added by garfx on Thu, 10 Feb 2022 04:42:20 +0200

type_traits-integer_sequence Resolution (add variable parameters in inheritance mode)

preface Test what you have learned before. Learn how to use templates from the source code. Definition and use integer_sequence: judge whether it is an integer type. If it is not, the compilation fails (using static assertion). If it is, save its own type and the incoming integer type, as well as the length of variable parameters. inde ...

Added by kitchin on Thu, 10 Feb 2022 02:44:43 +0200