Recursive Solution
\n# Code\n\nclass Solution {\npublic:\n    void checkPairs(vector<string>& nums,string& target,int i,int j,int& count){\n         \n        if(i>=nums.size()){\
\n# Code\n```\nclass Solution {\npublic:\n    void checkPairs(vector<string>& nums,string& target,int i,int j,int& count){\n         \n        if(i>=nums.size()){\n          return;\n        }\n        if(j>=nums.size()){\n            checkPairs(nums,target,i+1,i+1,count);\n            return;\n        }\n        if((i!=j) && (nums[i]+nums[j]  == target)){\n      //    cout<<i<<" "<<j<<endl;\n          count++;\n           checkPairs(nums,target,i,j+1,count);\n        }else{\n           checkPairs(nums,target,i,j+1,count);\n        }\n\n    }\n    void checkPairs1(vector<string>& nums,string& target,int i,int j,int& count){\n         \n       if(i<0){\n         return;\n       }\n       if(j<0){\n          checkPairs1(nums,target,i-1,i-1,count);\n          return;\n       }\n       if((i!=j) && nums[i]+nums[j] == target){\n       //     cout<<j<<" "<<i<<endl;\n         count++;\n          checkPairs1(nums,target,i,j-1,count);\n       }else{\n         checkPairs1(nums,target,i,j-1,count);\n       }\n\n    }\n    int numOfPairs(vector<string>& nums, string target) {\n        int count = 0;\n\n        checkPairs(nums,target,0,0,count);\n        checkPairs1(nums,target,nums.size()-1,nums.size()-1,count);\n        return count;\n    }\n};\n```
['C++']