This commit is contained in:
2025-09-15 21:12:04 +08:00
commit 3f58f483ff
144 changed files with 5298 additions and 0 deletions

35
else/topic/2021.h Normal file
View File

@@ -0,0 +1,35 @@
#include <vector>
#include <stack>
using namespace std;
int test1(vector<int> array)
{
if (array.empty())
{
return INT_MIN;
}
stack<int> S;
int norm = array[0];
int m = INT_MIN;
S.push(array[0]);
for (int i = 1; i < array.size(); i++)
{
m = max(m, norm - array[i]);
while (!S.empty() && array[i] > S.top())
{
S.pop();
}
if (S.empty())
{
norm = array[i];
}
S.push(array[i]);
}
return m;
}
#include "../structs/Tree.h"
int test2(TreeNode *root){
//先镜像,再按需遍历
}