C# recursion
The idea is to compute all of the combinationations. and to find out if they are unique or not.\n\n1. In order to understand if a string if unique or not we can
The idea is to compute all of the combinationations. and to find out if they are unique or not.\n\n1. In order to understand if a string if unique or not we can use a set ( I used hashset, we can use any other represntation)\n2. In order to compute all combinationation we use.. recursion... if you think of for loops.. how many of those do you need...? we don\'t know ... so we use recurssion...\n3. in the recurs=sion we have the option to take a gives string or not... that\'s it.\n\n\n```\npublic class Solution {\n    public int MaxLength(IList<string> arr) \n    {\n       return MaxUnique(arr, 0, "");\n    }\n    \n    private int MaxUnique(IList<string> arr, int index, string curr)\n    {\n        if(index == arr.Count)\n        {\n            return IsUnique(curr);\n        }\n        if(IsUnique(curr)==-1)\n        {\n            return -1;\n        }\n        int res = MaxUnique(arr, index+1, curr);        \n        int res2 = MaxUnique(arr, index+1, curr+arr[index]);\n        return Math.Max(res, res2);\n        \n    }\n    \n     \n    private int IsUnique(string str)\n    {\n        HashSet<char> set = new HashSet<char>();\n        foreach(var c in str)\n        {\n            if(set.Contains(c))\n            {\n                return -1;\n            }\n            set.Add(c);\n        }\n        return str.Length;\n    }\n}\n```
['Recursion']