RECURSIVE & ITERATIVE SOLUTION || C++
Recursive\n\nclass Solution {\npublic:\n    string ans = "";\n    long long int get(int a,int b){\n        long long int ans = 1;\n        int k = a+b;\n       
# Recursive\n```\nclass Solution {\npublic:\n    string ans = "";\n    long long int get(int a,int b){\n        long long int ans = 1;\n        int k = a+b;\n        while(k>a){\n            ans *= k;\n            k--;\n            while(b>1&&ans%b==0){\n                ans /= b;\n                b--;\n            }\n        }\n        return ans;\n    }\n    void solve(int a,int b,int k,string s){\n        if(a<0||b<0)return ;\n        if(a==0&&b==0)ans = s;\n        long long int x = get(a,b-1);\n        if(k==1){\n            if(a==0){\n                solve(a,b-1,k,s+\'H\');\n            }else if(b==0){\n                solve(a-1,b,k,s+\'V\');\n            }\n        }\n        if(k*1LL>x){\n            solve(a-1,b,k-x,s+\'V\');\n        }else{\n            solve(a,b-1,k,s+\'H\');\n        }\n    }\n    string kthSmallestPath(vector<int>& v, int k) {\n        solve(v[0],v[1],k,"");\n        return ans;\n    }\n};\n```\n\n# Iterator\n````\nclass Solution {\npublic:\n    long long int get(int a,int b){\n        long long int ans = 1;\n        int k = a+b;\n        while(k>a){\n            ans *= k;\n            k--;\n            while(b>1&&ans%b==0){\n                ans /= b;\n                b--;\n            }\n        }\n        return ans;\n    }\n    string kthSmallestPath(vector<int>& a, int b) {\n        int h = a[1],v=a[0],n=a[0]+a[1],i;\n        long long int x;\n        long long int k = b;\n        string ans = "";\n        for(i = 0; i < n; i++){\n            if(h){\n                x = get(h-1,v);\n                cout<<x<<" "<<k<<endl;\n                if(x>=k){\n                    ans += \'H\';\n                    h--;\n                }else{\n                    k -= x;\n                    ans += \'V\';\n                    v--;\n                }\n            }else{\n                ans += \'V\';\n                v--;\n            }\n        }\n        return ans;\n    }\n};\n````
['Array', 'Math', 'Recursion', 'Iterator', 'C++']