Noob Code : Easy to Understand
\n\n\n# Approach\n1. Initialize a counter variable c to 0. This variable will be used to keep track of the count of valid pairs.\n\n2. Create a copy of the nums
![image.png](https://assets.leetcode.com/users/images/87cbfdb7-580b-4159-8261-224ea78e98cf_1696273237.9498467.png)\n\n\n# Approach\n1. Initialize a counter variable `c` to 0. This variable will be used to keep track of the count of valid pairs.\n\n2. Create a copy of the `nums` list and store it in the `l` variable. This copy is created to avoid modifying the original list while iterating through it.\n\n3. Initialize a temporary variable `temp` to an empty string. This variable will be used to store the string temporarily while iterating through the list.\n\n4. Use a `for` loop to iterate through the `nums` list. The loop variable `i` represents the index of the current element being considered.\n\n5. Inside the loop, store the current element (string) in the `temp` variable.\n\n6. Remove the current element from the `l` list using the `pop` method. This is done to ensure that we don\'t use the same element twice to form a pair.\n\n7. Use another `for` loop to iterate through the remaining elements in the `l` list. The loop variable `j` represents the current element from the remaining elements.\n\n8. Check if concatenating the current element from the original `nums` list (at index `i`) with the current element `j` from the `l` list results in the `target` string. If `nums[i] + j` equals `target`, it means we have found a valid pair.\n\n9. If a valid pair is found, increment the counter variable `c` by 1.\n\n10. After the inner loop completes, insert the temporarily removed element (`temp`) back into the `l` list at its original index `i`. This is done to restore the original state of the list.\n\n11. Continue the outer loop to consider the next element in the `nums` list and repeat the process.\n\n12. Finally, return the value of the counter variable `c`, which represents the count of pairs that can be concatenated to form the `target` string.\n\n\n# Complexity\n- Time complexity: ***O(n^2)***\n- Space complexity: ***O(n)***\n\n# Code\n```\nclass Solution:\n    def numOfPairs(self, nums: List[str], target: str) -> int:\n        c=0\n        l=nums.copy()\n        temp=\'\'\n        for i in range (0,len(nums)):\n            temp=l[i]\n            l.pop(i)\n            for j in l:\n                if nums[i]+j==target:\n                    c+=1\n            l.insert(i,temp)\n        return(c)\n```
['Python3']