摘要:
Problem Description:http://oj.leetcode.com/problems/word-search/Basic idea: recursively go forward, use char '#' to mark the char visited, so no extra memory is need, don't forget to recover the previous char if the program cannot go forward. 1 class Solution { 2 public: 3 bool existSub( 阅读全文
摘要:
Problem Description:http://oj.leetcode.com/problems/same-tree/ 1 class Solution { 2 public: 3 bool isSameTree(TreeNode *p, TreeNode *q) { 4 // Note: The Solution object is instantiated only once and is reused by each test case. 5 if(p == NULL && q == NULL) 6 return tr... 阅读全文