[YBT2022 winter vacation Day6 C] [luogu CF1063F] substring selection / String Journey (SAM) (line segment tree) (multiplication)

Substring selection / String Journey Title Link: YBT2022 winter vacation Day6 C / luogu CF1063F General idea of the topic Give you a string. If you want to find the maximum K satisfaction, you can choose k disjoint substrings from left to right at a time to meet that the former is the real substring of the latter. thinking First of all, le ...

Added by jrose83 on Sat, 12 Feb 2022 09:10:21 +0200

GDUT ACM2022 winter vacation training topic II D E (01 backpack)

For a better reading experience, please go to: Paxton's little broken station 1, 01 Backpack 01 backpack is to take out several items from M items and put them in a backpack with space W. the volume of each item is W1, W2 to Wn, and the corresponding value is P1,P2 to Pn. 01 knapsack is the simplest problem in knapsack problem. 01 the ...

Added by Bijan on Sat, 12 Feb 2022 09:00:17 +0200

Multiple knapsack and its optimization

Problem description There are n kinds of goods, which have their own volume, value and certain quantity. How to maximize the total value of the items loaded in the backpack with a given capacity? Algorithmic thought Before solving the problem, for the convenience of description, first define some variables: vi represents the value of the ith ...

Added by yurko on Sat, 12 Feb 2022 08:25:19 +0200

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

Summary of knapsack problem

Classification of knapsack problems: 1. 01 knapsack problem 2. Complete knapsack problem 3. Multiple knapsack problem 4. Complete knapsack problem Solutions to DP problems: 01 knapsack problem Problem Description: see example: 01 knapsack problem Problem analysis: for each item, you can choose to or not. Therefore, the calculation of state i ...

Added by littlepeg on Fri, 11 Feb 2022 06:26:49 +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

[data structure and algorithm] in-depth analysis of the solution ideas and algorithm examples of "different paths"

1, Title Requirements A robot is located in the upper left corner of an m x n grid (the starting point is marked as "Start" in the figure below). The robot can only move down or right one step at a time. The robot tries to reach the lower right corner of the grid (marked as "Finish" in the figure below). How many different ...

Added by chris_s_22 on Wed, 09 Feb 2022 23:34:09 +0200

Algorithm problem of XOR operation

First give two algorithm questions for the interview. One number has an odd number and the other number has an even number. It is required to find this number, and the time complexity is O(n) and the space complexity is O(1)The two kinds of numbers appear odd times and the other numbers appear even times. It is required to find this number, an ...

Added by apollyon on Wed, 09 Feb 2022 14:39:42 +0200

Li Kou [494] target and

Title: Give you an integer array nums and an integer target. Add '+' or '-' before each integer in the array, and then concatenate all integers to construct an expression: For example, nums = [2, 1], you can add '+' before 2 and '-' before 1, and then concatenate them to get the expression "+ 2-1". Returns the number of different e ...

Added by suckablesausage on Wed, 09 Feb 2022 02:00:12 +0200

Analysis of recursion, recursion and dynamic programming

Concept introduction and understanding Recurrence: deduce the following results from the previous calculation results. Mathematical language description can deduce f(n) from f(0),f(1)... f(n-1), so recurrence formula is the key. Recursion: push forward from the back, start with the result, and push backward. The mathematical language descr ...

Added by kol090 on Tue, 08 Feb 2022 21:32:00 +0200