[C++] Set solution O(nlogn)
\nclass Solution {\npublic:\n    bool canReach(string s, int minj, int maxj) {\n        int n = s.size();\n        set<int> valid;\n        valid.insert(0);\n  
```\nclass Solution {\npublic:\n    bool canReach(string s, int minj, int maxj) {\n        int n = s.size();\n        set<int> valid;\n        valid.insert(0);\n        for (int i = 1; i < n; ++i)\n        {\n            if (s[i] == \'0\')\n            {\n                auto lo = valid.lower_bound(i - maxj);\n                auto hi = valid.lower_bound(i - minj);\n                if (lo != valid.end() && (*lo) == i - minj) {valid.insert(i);}\n                else if (hi != valid.end() && (*hi) == i - maxj) {valid.insert(i);}\n                else if (lo != hi) {valid.insert(i);}\n            }\n            \n        }\n        return valid.count(n - 1);\n    }\n};\n```
['C', 'Ordered Set']