VERY SIMPLE C++ || COUNT OF NULL,NOT NULL NODES
For a valid binary tree null==notnull+1\nVerify using example\n\n\nbool isValidSerialization(string pre) {\n        if(pre[0]==\'#\'){  //if root node #\n      
**For a valid binary tree `null==notnull+1`\nVerify using example**\n\n```\nbool isValidSerialization(string pre) {\n        if(pre[0]==\'#\'){  //if root node #\n            if(pre.size()==1)return true;\n            return false;\n        }\n        int null=0,notnull=0;  // counters for null and notnull nodes\n        for(int i=0;i<pre.size();i++){\n            if(pre[i]==\',\') continue;  // skip if \',\'\n            else if(pre[i]==\'#\')null++;  //incriment null counter if \'#\' comes\n            else{\n                while(i<pre.size() && pre[i]!=\',\')i++;  // for values like \'65\' \n                notnull++;\n            }\n            if(null>=notnull+1 && i!=pre.size()-1) return false;  // at every iteration check\n        }\n        return null==notnull+1;\n    }\n```
[]