Similar C++ solution

class Solution { public: bool isSubtree(TreeNode* s, TreeNode* t) { return isSametree(s, t) || (s != nullptr && (isSubtree(s -> left, t) || isSubtree(s -> right, t))); } bool isSametree(TreeNode *s, TreeNode *t) { if(s == nullptr && t == nullptr) return true; if(s == nullptr || t == nullptr) return false; return s -> val == t -> val && isSametree(s -> left, t -> left) && isSametree(s -> right, t -> right); } };Subtree of Another Tree