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)


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