Skip to content

Commit e7394cf

Browse files
committed
1441 added.
1 parent 78bf32c commit e7394cf

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
project(A)
3+
4+
set(CMAKE_CXX_STANDARD 14)
5+
6+
add_executable(A main.cpp)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/// Source : https://leetcode.com/problems/build-an-array-with-stack-operations/
2+
/// Author : liuyubobobo
3+
/// Time : 2020-05-10
4+
5+
#include <iostream>
6+
#include <vector>
7+
8+
using namespace std;
9+
10+
11+
/// Simulation
12+
/// Time Complexity: O(n)
13+
/// Space Complexity: O(1)
14+
class Solution {
15+
public:
16+
vector<string> buildArray(vector<int>& target, int n) {
17+
18+
vector<string> res;
19+
int next = 1;
20+
for(int t: target){
21+
while(t != next) res.push_back("Push"), res.push_back("Pop"), next ++;
22+
res.push_back("Push"), next ++;
23+
}
24+
return res;
25+
}
26+
};
27+
28+
29+
int main() {
30+
31+
return 0;
32+
}

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,7 @@ email: [liuyubobobo@gmail.com](mailto:liuyubobobo@gmail.com)
10381038
| 1438 | [Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit](https://leetcode.com/problems/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit/) | [] | [C++](1438-Longest-Continuous-Subarray-With-Absolute-Diff-Less-Than-or-Equal-to-Limit/cpp-1438/) | | |
10391039
| 1439 | [Find the Kth Smallest Sum of a Matrix With Sorted Rows](https://leetcode.com/problems/find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows/) | [] | [C++](1439-Find-the-Kth-Smallest-Sum-of-a-Matrix-With-Sorted-Rows/cpp-1439/) | | |
10401040
| 1440 | Database Problem: [Link](https://github.com/liuyubobobo/Play-Leetcode-Database/) | - | - | - | - |
1041+
| 1441 | [Build an Array With Stack Operations](https://leetcode.com/problems/build-an-array-with-stack-operations/) | [] | [C++](1441-Build-an-Array-With-Stack-Operations/cpp-1441/) | | |
10411042
| | | | | | |
10421043

10431044
## 力扣中文站比赛

0 commit comments

Comments
 (0)