leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1441.cpp (371B)


0 class Solution { 1 public: 2 vector<string> buildArray(vector<int> &target, int n) { 3 vector<string> res; 4 int stream = 1; 5 for (int t : target) { 6 while (stream++ != t) { 7 res.push_back("Push"); 8 res.push_back("Pop"); 9 } 10 res.push_back("Push"); 11 } 12 return res; 13 } 14 };