# 题目

Say you have an array for which the i-th element is the price of a given stock on day i.

Design an algorithm to find the maximum profit. You may complete at most k transactions.

Note: You may not engage in multiple transactions at the same time (ie, you must sell the stock before you buy again).

Example 1:

Example 2:

# 题目

Given an unsorted array, find the maximum difference between the successive elements in its sorted form.

Return 0 if the array contains less than 2 elements.

Example 1:

Example 2:

Note:

• You may assume all elements in the array are non-negative integers and fit in the 32-bit signed integer range.
• Try to solve it in linear time/space.

# 题目

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.

(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).

Find the minimum element.

The array may contain duplicates.

Example 1:

Example 2:

Note:

• This is a follow up problem to .
• Would allow duplicates affect the run-time complexity? How and why?

# 题目

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.

Example 1:

Example 2:

NOTE: input types have been changed on April 15, 2019. Please reset to default code definition to get new method signature.

# 题目

The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially positioned in the top-left room and must fight his way through the dungeon to rescue the princess.

The knight has an initial health point represented by a positive integer. If at any point his health point drops to 0 or below, he dies immediately.

Some of the rooms are guarded by demons, so the knight loses health (negative integers) upon entering these rooms; other rooms are either empty (0's) or contain magic orbs that increase the knight's health (positive integers).

In order to reach the princess as quickly as possible, the knight decides to move only rightward or downward in each step.

Write a function to determine the knight's minimum initial health so that he is able to rescue the princess.

For example, given the dungeon below, the initial health of the knight must be at least 7 if he follows the optimal path RIGHT-> RIGHT -> DOWN -> DOWN.

-2 (K) -3 3
-5 -10 1
10 30 -5 (P)

Note:

• The knight's health has no upper bound.
• Any room can contain threats or power-ups, even the first room the knight enters and the bottom-right room where the princess is imprisoned.

# 题目

Given a binary tree, return the postorder traversal of its nodes' values.

Example:

Follow up: Recursive solution is trivial, could you do it iteratively?

# 收集的部分VPS常用脚本或网站

• 测ICMP && 测TCP

• BBR N合1脚本，包含bbr原版，bbr puls，锐速，bbr2等

# pytorch安装问题

• 运行以下命令下载sh文件：

其他版本的文件可以上 https://repo.continuum.io/archive/ 上查找，然后wget即可

• 安装Anaconda3

一路回车或yes即可，有需要的话安装时可以自行更改一些设置