Summary of dynamic programming of leetcode 3
Summary of dynamic programming of leetcode 3
1 - house raiding Title Link: Title Link stamp here!!!
Idea: the idea of this question is not difficult, but we need to pay attention to the details. Recurrence formula: DP [i] = max (DP [I-1], DP [I-2] + num [i])
class Solution {
public int rob(int[] nums) {
if(nums.length==1){
...
Posted by dwnz on Sat, 12 Feb 2022 03:49:12 +0100
[PCL self study: Feature8] introduction and use of ROPS (rotating projection statistics) feature recognition object (continuously updated)
1, Introduction to the characteristic principle of ROPS (rotational projection statistics)
in this article, we continue to learn how to use the PCL:: ropestimate class to extract the features of points. The feature extraction method implemented in this class is written by Yulan Guo, ferdous sohel, Mohammed bennamon, min Lu and Jianwei w ...
Posted by wilzy1 on Sat, 12 Feb 2022 02:00:32 +0100
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
Educational Codeforces Round 109 (Rated for Div. 2) D. Armchairs (dp)
Link Title: https://codeforces.com/contest/1525/problem/D
Main idea of the title:
0,1 sequence of numbers, a[i]=0 or 1. The number of 1 must not exceed half of n. We need to pair all 1s with a 0. A 0 can only be paired with a 1 ifandPairing will consumeResources. What is the minimum total resource consumption after all 1s are paired?
Solutio ...
Posted by a.beam.reach on Sat, 12 Feb 2022 00:57:10 +0100
Selective sorting method of basic sorting algorithm
1, The idea of selecting sorting method: first take out the smallest (large) element, then take out the smallest (large) element in the remaining elements, and select the smallest (large) element among the unprocessed elements for sorting each time.
1. Two ideas:
① open up a new array space and put the smallest (large) elements in the new arr ...
Posted by phillfox on Sat, 12 Feb 2022 00:08:49 +0100
ZJUT2021 first search in the second semester [2]
E - POJ1915 Knight Moves:
Background Mr Somurolov, fabulous chess-gamer indeed, asserts that no one else but him can move knights from one position to another so fast. Can you beat him?The Problem Your task is to write a program to calculate the minimum number of moves needed for a knight to reach one point from another, so that you have the ...
Posted by stirton on Fri, 11 Feb 2022 23:28:35 +0100
Roommate taught me quick sort (C)
1. Sorting principle
Quick sort is an exchange sort method of binary tree structure proposed by Hoare in 1962. Its basic idea is: any element in the element sequence to be sorted is taken as the reference value, and the set to be sorted is divided into two subsequences according to the sort code. All elements in the left subsequence are less t ...
Posted by munsiem on Fri, 11 Feb 2022 22:21:46 +0100
LeetCode - the largest rectangle in the histogram (monotone stack)
Monotonous stack
Monotone: therefore, the data stored in the monotone stack should be orderly, so the monotone stack is also divided into monotone increasing stack and monotone decreasing stack.
Monotonically increasing stack: monotonically increasing stack is from the bottom of the stack to the top of the stack, and the data is from ...
Posted by Ambush Commander on Fri, 11 Feb 2022 21:55:13 +0100
Python implementation of genetic algorithm (solving function extremum problem)
Problem description
f(x)=x*sin(x)+1, x belongs to [0,2 π]. Taking solving the maximum and minimum value of f(x) as an example, a genetic algorithm program for f(x) is designed, and then run to solve it (1) Determine the basic functions: this experiment is to solve the maximum and minimum values of f (x). (2) Encoding f(x): a chromosome ...
Posted by HairBomb on Fri, 11 Feb 2022 18:25:17 +0100
Research on consistent HASH algorithm
Research on consistent HASH algorithm
Contributor: underground Stalker
1. Introduction
When studying the CRUSH algorithm of distributed storage Ceph, I saw the article introduce that it is a special consistency HASH algorithm, so I began to study the consistency HASH algorithm, make early preparation, and found that the concept is indeed clo ...
Posted by nightowl on Fri, 11 Feb 2022 16:50:58 +0100