[LeetCode learning plan] Introduction to data structure - C + +, day 14 tree

LeetCode [learning plan]: [data structure] 98. Validate binary search tree LeetCode: 98. Validate binary search tree in etc. \color{#FFB800} {medium} secondary Give you the root node of a binary tree, root, to determine whether it is an effective binary search tree. A valid binary search tree UTF-8...

Posted by nyfael on Fri, 17 Dec 2021 16:43:03 +1030

December 13-14-15-16-17, 2021

Third week of December 2021 Station B left God Leetcode video Merge sort package class02; import java.util.Arrays; public class Code01_MergeSort { public static void mergeSort(int[] arr) { if (arr == null || arr.length < 2) { return; } mergeSort(arr, 0, arr.length - 1); } public static void merUTF-8...

Posted by johnathanhebert on Fri, 17 Dec 2021 22:18:48 +1030

[Leetcode] dictionary tree

208. Implement Trie (prefix tree) Trie (pronounced like "try") or prefix tree is a tree data structure used to efficiently store and retrieve keys in string data sets. This data structure has many application scenarios, such as automatic completion and spell checking. Please implement the Trie UTF-8...

Posted by nitram on Sat, 18 Dec 2021 08:29:45 +1030

leetcode algorithm entry Article 6 sliding window**

Minimum covering substring method The idea of sliding window algorithm is as follows: 1. We use the left and right pointer technique in the double pointer in the string S, initialize left = right = 0, and call the index closed interval [left, right] a "window". 2. We first continuously increasUTF-8...

Posted by NoMansLand on Sat, 18 Dec 2021 09:18:43 +1030

Knapsack problem in dynamic programming

Reference link Wechat reference 1 Wechat reference 2 Reference 1 Reference 2 Reference 3 Nonsense for yourself To put it simply, two-dimensional bp is easy to understand. The dp recurrence equation is max (using the item in i and not using the item in i). If i represents 0-i, you can choose j UTF-8...

Posted by Dillinger on Sat, 18 Dec 2021 12:58:54 +1030

Maximum suborder sum

53. Maximum subsequence sum Method 1: dynamic programming Define status dp[i]: represents the maximum sum of consecutive subarrays ending in nums[i]. State transition equation d p [ i ] = { d p [ i − 1 ] + n u m s [ i ] dp[i−1]>0 n u m s [ i ] dp[i−1]≤0 dp[i]= \begin{cases} dp[i−1]+nums[i]& \teUTF-8...

Posted by tidalik on Sun, 19 Dec 2021 06:51:20 +1030

2021-08-27 maximum palindrome substring leetcode

Method 1: dynamic programming Ideas and algorithms For a substring, if it is a palindrome string and its length is greater than 2, it will still be a palindrome string after removing the first and last two letters. For example, for the string "ababa", if we already know that "bab" is a palindroUTF-8...

Posted by sp0rk on Sun, 19 Dec 2021 08:13:50 +1030

Force buckle play strange record 005

Force buckle play strange record 005 More questions today~~ Topic 1: judgment repetition Given an integer array, determine whether there are duplicate elements. If a value exists and appears in the array at least twice, the function returns true. If each element in the array is different, falseUTF-8...

Posted by caminator on Sun, 19 Dec 2021 09:42:46 +1030

[punch in] - [LeetCode learning plan] Introduction to data structure - C + +, day 10 tree

Original link; [LeetCode learning plan] Introduction to data structure - C + +, day 10 tree _Wang_Xin_Ling's blog - CSDN blog Method 1: recursion In the tree traversal process, after entering the left child and the right child, you need to traverse in the same traversal order until you traversUTF-8...

Posted by mfos on Sun, 19 Dec 2021 23:37:38 +1030

Dynamic programming idea of LeetCode Introduction Guide

It is recommended to learn labuladong's dynamic programming series : you can understand what dynamic programming is first. You don't have to read it all at once. Then try to do it yourself. If you have no ideas, go back and look at the corresponding articles. Dynamic programming can generally bUTF-8...

Posted by Linjon on Mon, 20 Dec 2021 05:26:31 +1030