My python solution
Brute Force Solution\n\nclass Solution:\n    def numOfPairs(self, nums: List[str], target: str) -> int:\n        c=0\n        for i in range(len(nums)) :\n     
**Brute Force Solution**\n```\nclass Solution:\n    def numOfPairs(self, nums: List[str], target: str) -> int:\n        c=0\n        for i in range(len(nums)) :\n            for j in range(len(nums)) :\n                if i!=j:\n                    if nums[i]+nums[j]==target:\n                        c+=1\n        return c\n        \n```\n**TC: O(N^2)**\n**SC: O(1)**\n\n**Optimized solution**\n```\nclass Solution:\n    def numOfPairs(self, nums: List[str], target: str) -> int:\n        freq = Counter(nums)\n        ans = 0 \n        for k, v in freq.items(): \n            if target.startswith(k): \n                suffix = target[len(k):]\n                ans += v * freq[suffix]\n                if k == suffix: ans -= freq[suffix]\n        return ans \n\n```\n**TC: O(N)**\n**SC: O(N)**
[]