C++ map
\tInitially i thought using DP ,but at some time memory limit exceeded and at the other time it was time limit  exceeded.\n\tin my case graph also didn\'t work.
\tInitially i thought using DP ,but at some time memory limit exceeded and at the other time it was time limit  exceeded.\n\tin my case graph also didn\'t work.\n\t\n\tfrom the starting you can take max of maximum jump and minimum jump, i make a prefix array of \'0\' so that i can find at the gap of min and max index is there any zero or not.\n\tif not then it\'s not possible to reach at the end simply return 0;\n\telse i find the max index from right value having 0 and i did the same for from left.\n\ttaking all possibility from min and max index i find the new min and max index.\n\tand push that index into a map;\n\tif to reach at the end, the indexes will not repeat.\n\tand checking the condition if we are able to reach at the end or not.\n\t\n\tand it\'s work for me.\n\t\n\tPS: i was not able to solve this problem at contest time and sorry for my bad english.\n\t\n\there is my code:\n\t\n\t\n\n```\nclass Solution {\npublic:\n    bool canReach(string s, int mn, int mx) {\n        int n=s.length();\n        if(s[n-1]==\'1\')\n            return 0;\n        vector<int> pre(n,0),v(4);\n        pre[0]=1;\n        for(int i=1;i<n;i++)\n        {\n            if(s[i]==\'0\')\n                pre[i]=pre[i-1]+1;\n            else\n                pre[i]=pre[i-1];\n        }\n        int mn_jump=0,mx_jump=0;\n        map<int,int> my_max,my_min;\n        while(1)\n        {\n                v[0]=mn_jump+mx;\n                v[1]=mx_jump+mn;\n                v[2]=mn_jump+mn;\n                v[3]=mx_jump+mx;\n                sort(v.begin(),v.end());\n                int temp1=v[0];\n                int temp2=v[3];\n                my_max[temp2]++;\n                my_min[temp1]++;\n                if(my_max[temp2]>1 || my_min[temp1]>1)\n                    return 0;\n               \n              //  cout<<temp1<<" "<<temp2<<endl;\n                if(temp1==n-1 || temp2==n-1 || (temp1<n && temp2>=n))\n                    return 1;\n                if(temp1>=n)\n                    return 0;\n                if((pre[temp2]-pre[temp1-1]) ==0)\n                    return 0;\n                //cout<<"prefix is"<<pre[temp2]<<" "<<pre[temp1-1]<<endl;\n                for(int j=temp2;j>=temp1;j--)\n                {\n                    if(s[j]==\'0\')\n                    {\n                        temp2=j;\n                        break;\n                    }\n                }\n                for(int j=temp1;j<=temp2;j++)\n                {\n                    if(s[j]==\'0\')\n                    {\n                        temp1=j;\n                        break;\n                    }\n                }\n                cout<<temp1<<" "<<temp2<<endl;\n                mn_jump=min(temp1,temp2);\n                mx_jump=max(temp1,temp2);\n        }\n        return -1;\n        \n    }\n};\n```
['C', 'Sliding Window']