First Amazon Phone Interview
Introduce the android application you did.
the project you did fun
right you are wrong
what is content provider
what is intent
coding:
isValidPalindrome demo
public boolean isValid(String s){
if(s == null) return true;
int left = 0, right = s.length()-1;
while(left < right){
if(s.charAt(left) != s.charAt(right)) return false;
left++;
right--;
}
return false;
}
2. binary tree: has at most two tree node
L110 balanced binary tree
why + 1: we need to add current root's height;
public boolean isBalanced(TreeNode root){
if(root == null) return true;
int left = getHeight(root.left);
int right = getHeight(root.right);
return Math.abs(left - right) <= 1 &&
isBalanced(root.left) && isBalanced(root.right);
}
private int getHeight(TreeNode root){
if(root == null) return 0;
int left = getHeight(root.left);
int right = getHeight(root.right);
return Math.max(left,right)+1;
}
3. ood design 扑克牌
Last updated
Was this helpful?