category-wise-problems

contains category wise problems(data structures, competitive) of popular platforms.

View the Project on GitHub mayankdutta/category-wise-problems

942. DI String Match

Implementation ```cpp class Solution { public: vector diStringMatch(string s) { int mx = 0; int mn = 0; vector ans; ans.push_back(0); for (auto i: s) { if (i == 'I') ans.push_back(mx + 1), mx ++; else if (i == 'D') ans.push_back(mn - 1), mn --; } for (int i = 0; i < ans.size(); i++) ans[i] -= mn; return ans; } }; ``` </details>