Daily supplementary record 5

2.7 ​​​​​​1405. Longest happy string If the string does not contain any strings such as' aaa ',' bbb 'or' ccc 'as substrings, the string is a "happy string". Here are three integers a, b and c. please return any string s that meets all the following conditions: s is a happy string as long as possible. There are at most a letters' ...

Posted by labourstart on Sat, 12 Feb 2022 01:50:39 +0100

Beginner greedy algorithm

P2240 [deep foundation 12. Example 1] some knapsack problems Title Description Ali Baba walked into a treasure hole full of treasures. There are N(N ≤ 100) piles of gold coins in the treasure cave. The total weight and total value of the I pile of gold coins are MI and VI (1 < = MI, VI < = 100). Alibaba has a backpack with a weight ...

Posted by cauchyResidue on Wed, 09 Feb 2022 00:13:11 +0100

Longest incremental subsequence (LIS) dynamic programming, greedy + dichotomy (java version)

catalogue Problem Description: Dynamic programming: (n^2) java code: Greed + dichotomy: (nlongn) java code: Use of binarysearch(): Problem Description: Given a sequence, such as arr=[10, 9, 2, 5, 3, 7, 101, 18], find the longest increasing subsequence of the sequence. The longest increasing subsequence (LIS) can be solved by dynamic p ...

Posted by Jeremy_North on Tue, 08 Feb 2022 12:19:44 +0100

[Greedy] 1405. Longest happy string. M

1. Description 1. If the string does not contain any'aaa','bbb'or'ccc' as a substring, then the string is a'happy string'. 2. Give you three integers a, b, c. Please return any string s that meets all of the following conditions: s is a happy string as long as possible. There are at most a letter'a', B letter'b', c letter'c'in s. s contains on ...

Posted by nemxu on Mon, 07 Feb 2022 19:13:04 +0100

KY4 Proxy Server

describe The use of proxy servers can hide client information to some extent, thus protecting users'privacy on the Internet. We know the IP addresses of n proxy servers and now use them to access m servers. The IP address and access order of the M servers are also given. The system can only use one proxy server at a time and requires that it c ...

Posted by hermand on Mon, 07 Feb 2022 18:29:14 +0100

Greedy algorithm of algorithm

Greedy Algorithm Greedy algorithm (greedy algorithm) refers to the algorithm that takes the best or optimal (i.e. the most favorable) choice in each step when solving the problem, so as to lead to the best or optimal result The results obtained by greedy algorithm are not necessarily the optimal results (sometimes the optimal solution), but t ...

Posted by genesysmedia on Mon, 07 Feb 2022 10:46:26 +0100

[Likou daily question] longest happy string

Li Kou daily question 20207 Topic description If the string does not contain any strings such as' aaa ',' bbb 'or' ccc 'as substrings, the string is a "happy string". Here are three integers a, b and c. please return any string s that meets all the following conditions: s is a happy string as long as possible. There are at mo ...

Posted by kailien on Mon, 07 Feb 2022 06:43:19 +0100

LeetCode C++ 1881. Maximum Value after Insertion

You are given a very large integer n, represented as a string,​​​​​​ and an integer digit x. The digits in n and the digit x are in the inclusive range [1, 9], and n may represent a negative number. You want to maximize n's numerical value by inserting x anywhere in the decimal representation of n​​​​​​. You cannot insert x to the left of the ...

Posted by curioadmin on Sat, 05 Feb 2022 11:34:33 +0100

MEX Sequences (state machine DP)

MEX Sequences [Link](Problem - D - Codeforces) meaning of the title Give you a sequence x n x_n xn, how many subsequences do you satisfy ∣ x ...

Posted by Stressed on Thu, 03 Feb 2022 07:04:39 +0100

BFS and DP -- the 70th biweekly match of Li Kou

⭐ New pit in winter vacation -- daily question notes of code Fox First question, greedy thought (take the largest two at a time, and then the largest third for free - the amount of sugar you can take for free is limited. Why not take one expensive one for free) The second problem is mathematical thinking (all numbers are in a range, so you onl ...

Posted by sparrrow on Wed, 02 Feb 2022 18:05:46 +0100