This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution { | |
| public: | |
| bool canJump(vector<int>& nums) { | |
| int n = nums.size(); | |
| int reachable = 0; | |
| for(int i=0;i<n;++i) | |
| { | |
| if(reachable < i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution { | |
| public: | |
| int singleNonDuplicate(vector<int>& nums) { | |
| ios_base::sync_with_stdio(false); | |
| cin.tie(NULL); | |
| int high = nums.size()-1; | |
| int low = 0; | |
| int mid; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution { | |
| public: | |
| string removeKdigits(string num, int k) { | |
| ios_base::sync_with_stdio(false); | |
| cin.tie(NULL); | |
| int n = num.size(); | |
| stack<char> mystack; | |
| //Store the final string in stack | |
| for(char c: num) |