? Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. ? leetcode 最長公共子序列?這道題要求用先序和中序遍歷來建立二叉樹,跟之前那道Construct Binary Tree from Inorde
Determine whether an integer is a palindrome. Do this without extra space. 題目大意:略 bool isPalindrome(int x) {int reverse = 0;int back = x;if(x < 0)return false;while(x){reverse = reverse * 10 + x % 10;x /= 10;}if(back
LeetCode:Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. 分析:和从