Basic problems of dynamic programming

1, Basic dynamic programming Like greedy algorithm, in dynamic programming, the solution of a problem can be regarded as the result of a series of decisions. The difference is that in the greedy algorithm, an irrevocable decision is made every time the greedy criterion is used, while in dynamic programming, it is also necessary to investig ...

Added by banned in dc on Fri, 04 Feb 2022 06:10:44 +0200

LeetCode Learning - Day 29

Day 29 I use C++, forgive me for the mistake. The article was meant to urge me to learn. I would be very happy if it happened to help you. I. 39. Combination Sum Give you an array of integers with no duplicate elements, candidates, and a target integer target, find all the different combinations in candidates that can make numbers and tar ...

Added by tipjones on Thu, 03 Feb 2022 21:23:42 +0200

On Array Base Operations

1. Overview of arrays During the execution of a program, a large amount of data is often stored. Java and many advanced languages provide a data structure called an array that can be used to store an ordered set of fixed number of elements with the same element type. Array mainly solves the storage problem of multivariable and multidata, and fa ...

Added by hailam on Thu, 03 Feb 2022 19:55:45 +0200

Leetcode73. Matrix Zero

Title Description Given a matrix of m x n, if an element is 0, all elements of its row and column are set to 0. Please use In place Algorithms. Input: matrix = [[0,1,2,0],[3,4,5,2],[1,3,1,5]] Output: [[0,0,0,0], [0,4,5,0], [0,3,1,0]] Source: LeetCode Links:   https://leetcode-cn.com/problems/set-matrix-zeroes Method 1: O(m + n) spat ...

Added by dethron on Thu, 03 Feb 2022 19:40:12 +0200

Recursive nanny tutorial

If this article is helpful to you, please also 'praise and pay attention', and give me the greatest encouragement to those who are very lost because of the upcoming school. When I brush the force buckle, I find that it is slightly clumsy to deal with some problems such as double recursion, especially some assignment and condition judgment ar ...

Added by sssphp on Thu, 03 Feb 2022 17:27:50 +0200

Brush the Blue Bridge Cup once a day (the next day)

preface Just two months from the Blue Bridge Cup, the last horn has sounded and there is no retreat! In the last time, it is difficult to thoroughly understand the algorithm required by the game, but the final result may not be very good, so we use the form of real problem + analysis to make the final sprint! Don't say much, open our n ...

Added by dangyadang on Thu, 03 Feb 2022 16:24:06 +0200

200 - number of islands

subject Give you a two-dimensional grid composed of '1' (land) and '0' (water). Please calculate the number of islands in the grid. Islands are always surrounded by water, and each island can only be formed by adjacent land connections in the horizontal and / or vertical direction. In addition, you can assume that all four sides of the mesh ...

Added by quetz67 on Thu, 03 Feb 2022 16:16:38 +0200

[daily force deduction 37] looting

1, Title [LeetCode-198] You are a professional thief who plans to steal houses along the street. There is a certain amount of cash hidden in each room. The only restrictive factor affecting your theft is that the adjacent houses are equipped with interconnected anti-theft systems. If two adjacent houses are intruded by thieves on the same nigh ...

Added by ekosoftco on Thu, 03 Feb 2022 13:34:45 +0200

Production system

Production system Production system is used to describe several different systems based on a basic concept, which is production rules or production conditions and operation pairs. In production system, the knowledge of discourse is divided into two parts: using facts to represent static knowledge; Production rules are used to represent reas ...

Added by songwind on Thu, 03 Feb 2022 12:27:59 +0200

I want to beat dynamic programming - edit distance

392. Judgment subsequence 1. Title Given the strings S and t, judge whether s is a subsequence of t. A subsequence of a string is a new string formed by deleting some (or not deleting) characters from the original string without changing the relative position of the remaining characters. (for example, "ace" is a subsequence of &quo ...

Added by k9underdog on Thu, 03 Feb 2022 11:23:21 +0200