<commit_before>// Time:  O(m * n)
// Space: O(1)

/**
 * Definition of TreeNode:
 * class TreeNode {
 * public:
 *     int val;
 *     TreeNode *left, *right;
 *     TreeNode(int val) {
 *         this->val = val;
 *         this->left = this->right = NULL;
 *     }
 * }
 */
 
 // Morris Traversal.
class Solution {
public:
    /**
     * @param T1, T2: The roots of binary tree.
     * @return: True if T2 is a subtree of T1, or false.
     */
    bool isSubtree(TreeNode *T1, TreeNode *T2) {
        if (!T2) {
            return true;
        } else if (!T1) {
            return false;
        }
        TreeNode *prev = nullptr;
        TreeNode *curr = T1;
        while (curr) {
            if (!curr->left) {
                if (isSameTree(curr, curr, T2)) {
                    return true;
                }<commit_msg>Update subtree.cpp<commit_after>// Time:  O(m * n)
// Space: O(1)

/**
 * Definition of TreeNode:
 * class TreeNode {
 * public:
 *     int val;
 *     TreeNode *left, *right;
 *     TreeNode(int val) {
 *         this->val = val;
 *         this->left = this->right = NULL;
 *     }
 * }
 */
 
 // Morris Traversal.
class Solution {
public:
    /**
     * @param T1, T2: The roots of binary tree.
     * @return: True if T2 is a subtree of T1, or false.
     */
    bool isSubtree(TreeNode *T1, TreeNode *T2) {
        if (!T2) {
            return true;
        }
        TreeNode *prev = nullptr;
        TreeNode *curr = T1;
        while (curr) {
            if (!curr->left) {
                if (isSameTree(curr, curr, T2)) {
                    return true;
                }
{'fraction_non_alphanumeric': 0.13949163050216987, 'fraction_numerical': 0.013019218846869188, 'mean_word_length': 1.4678899082568808, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4352169', 'n_tokens_mistral': 544, 'n_tokens_neox': 532, 'n_words': 152}