class Solution {
public:
bool isPalindrome(string s) {
string ret;
for(char ch :s)
{
if(isalnum(ch))
{
ret += tolower(ch);
}
}
int n = ret.size();
int left = 0 ,right = n-1;
while(left<right)
{
if(ret[left++] != ret[right--])
{
return false;
}
}
return true;
}
};
class Solution {
public:
bool isSubsequence(string s, string t) {
int n = s.length();
int m = t.length();
int i =0,j=0;
if(n > m)
return false;
while(i < n && j < m)
{
if(s[i] == t[j])
{
i++;
}
j++;
}
return i == n;
}
};
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
* };
*/
class Solution {
public:
int maxDepth(TreeNode* root) {
if(!root)
return 0;
return max(maxDepth(root->left),maxDepth(root->right))+1;
/* if(!root)
return 0;
int leftdeep = maxDepth(root->left);
int rightdeep = maxDepth(root->right);
return max(leftdeep,rightdeep)+1;*/
}
};