easy c++ solution || beats 100%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int numberOfChild(int n, int k) {\n       \n       int i=0;\n       bool vis=false;\n       while(k>0)\n       {\n        if(i==0)\n        {\n            vis=false;\n        }\n        else if(i==n-1)\n        {\n            vis=true;\n        }\n        if(vis==false)\n        {\n            i++;\n        }\n        else\n        {\n            i--;\n        }\n        k--;\n     } \n       return i;\n    }\n};\n```
['C++']