📌📌 C++ || Backtracking || Easy To Understand
Backtracking\n\n\nclass Solution {\npublic:\n    \n    int maxi = 0;\n    \n    // function for checking uniqueness of the string\n    \n    bool is_unique(stri
* ***Backtracking***\n\n```\nclass Solution {\npublic:\n    \n    int maxi = 0;\n    \n    // function for checking uniqueness of the string\n    \n    bool is_unique(string& str)\n    {\n        int n = str.size();\n        \n        // mp will store the count of all the characters in string\n        \n        vector<int> mp(26, 0);\n        \n        for(int i = 0; i < n; i++)\n        {\n            mp[str[i] - \'a\']++;\n            \n            // if we found duplicates return false\n            \n            if(mp[str[i] - \'a\'] > 1)\n                return false;\n        }\n        \n        return true;\n    }\n    \n    void helper(vector<string>& arr, int i, int n, string curr)\n    {\n        // if we have got duplicate int our result then simply return\n        \n        if(is_unique(curr) == false)\n            return;\n        \n        // base case\n        \n        if(i == n)\n        {\n            // update maxi\n            \n            if(curr.size() > maxi)\n            {\n                int size = curr.size();\n                \n                maxi = max(maxi, size);\n            }\n            \n            return;\n        }\n        \n        // we have two options either include the curr string or exclude\n        \n        // include the curr string\n        \n        helper(arr, i + 1, n, curr + arr[i]);\n        \n        // exclude the curr string\n        \n        helper(arr, i + 1, n, curr);\n    }\n    \n    int maxLength(vector<string>& arr) {\n        \n        int n = arr.size();\n        \n        // call helper function\n        \n        helper(arr, 0, n, "");\n        \n        return maxi;\n    }\n};\n```
['Backtracking', 'Recursion', 'C', 'C++']