Follow the Zuo Shen Algorithm 02 Basics

 Question 1

 First, sort them by difficulty. If the difficulty is the same, sort by the highest income, because he can recruit countless people for each job. If the difficulty is the same, keep the largest one. The difficulty has increased, and the salary has become smaller, just throw it away. Just keep the difficulty and salary monotonous.

Use an ordered list to do it.

 The key is sorted.

Quickly find the nearest logn level less than a certain number

 

Question 2

 

 

First traverse from left to right, starting from 1, max is the value below the initial 0, and max records the maximum value of the crossed data. When traversing, the numbers on the left max<= and on the right will be marked with a check mark, and if the number is greater than the number on the right, an error mark will be drawn, and the position of the rightmost error mark will be recorded.

Then traverse from right to left, find the minimum value on the right, which is also the minimum value that is greater than or equal to the current value, and the error number that is less than the current value. Record the leftmost error number.

 Question 3

    LeetCode official website - the technology growth platform loved by geeks around the world

Guess you like

Origin blog.csdn.net/qq_52988841/article/details/132355570