mirror of
https://git.wolves.top/wolves/leetcode.git
synced 2025-11-05 01:36:32 +08:00
init
This commit is contained in:
21
else/topic/2023.h
Normal file
21
else/topic/2023.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <vector>
|
||||
#include<stack>
|
||||
using namespace std;
|
||||
|
||||
bool test1(vector<int> array){
|
||||
stack<int> S;
|
||||
for (int i = 0; i < array.size()/2; i++)
|
||||
{
|
||||
S.push(array[i]);
|
||||
}
|
||||
int tag = array.size()%2;
|
||||
for(int i = array.size()/2 + tag;i<array.size();i++){
|
||||
if (S.top() != array[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
S.pop();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user