leetcode

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

3211.cpp (359B)


0 class Solution { 1 public: 2 vector<string> validStrings(int n) { 3 vector<string> res = {"0", "1"}; 4 5 for (int i = 1; i < n; i++) { 6 for (int j = size(res) - 1; j >= 0; j--) { 7 if (res[j].back() == '1') res.push_back(res[j] + '0'); 8 res[j] += '1'; 9 } 10 } 11 12 return res; 13 } 14 };