Codeforces 1557c moamen and XOR (combinatorial thinking)

Title Link: Moamen and XOR General meaning Given n and k, let you construct a length of n n Sequence a [], each element less than 2 k 2^k ...

Posted by mr.rum on Sat, 01 Jan 2022 19:21:54 +0100

2021 "MINIEYE Cup" Chinese college students algorithm design super league part of the problem solution

C.VC Is All You Need meaning of the title Here you are n n n points at k k On the k dimension, judge whether you can use ...

Posted by genius on Fri, 31 Dec 2021 21:14:54 +0100

LeetCode 96. Different binary search trees

Title Description Give you an integer n and find how many kinds of binary search trees are composed of exactly n nodes with different node values from 1 to n? Returns the number of binary search trees that meet the meaning of the question. Example: Input: n = 3 Output: 5 dynamic programming thinking Given an ordered sequence 1 * ...

Posted by hadingrh on Thu, 30 Dec 2021 07:36:28 +0100

[dynamic programming] 01 knapsack and its optimization

Title Description There are N items and a backpack with a capacity of V. The space consumed by putting the i-th item is Ci, and the value obtained is Wi. Solve which items can be loaded into the backpack to maximize the total value without exceeding the capacity. Input format Two positive integers in line 1 represent N and V respecti ...

Posted by cpharry on Wed, 29 Dec 2021 13:27:25 +0100

Maximum subarray sum (maximum sum of continuous subarrays) -- Fundamentals

Maximum subarray sum (dynamic programming, divide and conquer): The solution of this problem is only for personal understanding. If there are other ideas or solutions, welcome to explore! Buckle link: Maximum sum of consecutive subarrays Title: Enter an integer array. One or more consecutive integers in the array form a sub array. ...

Posted by ihw13 on Tue, 28 Dec 2021 15:05:33 +0100

KMP (Knuth Morris Pratt) algorithm for string matching (illustration)

Longest prefix Give a string ABA Prefix set: {a, ab, aba, abab} Suffix set: {a, ba, aba, baba} The equal pre suffix is the set element marked with the same color above. The longest pre suffix is the longest of all equal pre suffixes, that is, the aba above. Take pictures for example: The prefix such as longest phase is the basis of K ...

Posted by decodv on Sun, 26 Dec 2021 17:58:35 +0100

2021.08. 09 [popularization group] simulation group C competition summary

2021.08. 09 [popularization group] simulation group C competition summary Write before: Today's exam is average. I didn't do very well. Continue to work hard next time! 😢😢😢 The mistake of this competition is that I didn't seriously read the meaning of the topic. Next time, I will continue to work hard! ok, let's start summarizing! ...

Posted by crosbystillsnas on Sun, 26 Dec 2021 17:48:26 +0100

Summary of some tree DP topics

1, A dance without a boss Title Description Ural university has N employees numbered 1~N. Their relationship is like a tree with the principal as the root, and the parent node is the direct boss of the child node. Each employee has a happiness index, which is given by the integer Hi, where 1 ≤ i ≤ N. Now we are going to hold a ...

Posted by jeffkee on Sun, 26 Dec 2021 15:37:26 +0100

[Algorithms] Use exercises to teach you how to use dynamic planning, super-detailed, at a glance!! Recommended collection!!

As long as you keep reading it, I'm sure you can learn it!! Preface Definition of Dynamic Planning (DP): Dynamic Planning is an extension of the idea of division, and in a general sense, it is the art of turning big things into small ones and small things into nothing. Dynamic planning has the following three characteristics: ...

Posted by johno on Sun, 26 Dec 2021 10:08:10 +0100

Introduction to leetcode 21 day dynamic planning -- climbing stairs from 0 to 0.5 [Day02]

Introduction to leetcode 21 day dynamic planning -- climbing stairs from 0 to 0.5 [Day02] Write in front Then in the last article, today Xiaofu ran up and down around the school built around the mountain, in order to eat shrimp dumplings with good taste. After all, today is the winter solstice. I hope all friends can also eat delicious dumpli ...

Posted by R0d Longfella on Sat, 25 Dec 2021 17:03:28 +0100