Javascript | Using new Set | Unoptimised Solution
Idea is to create all possible combination and calculate the max string which is having all unique characters in it without messing up the order\n\nCode:\n\n/**
Idea is to create all possible combination and calculate the max string which is having all unique characters in it without messing up the **order**\n\nCode:\n```\n/**\n * @param {string[]} arr\n * @return {number}\n */\nvar maxLength = function(arr) {\n    const set = new Set([\'\']);\n    let max = 0;\n    let str;\n    \n    for(let i = 0; i < arr.length; i++) {\n        const values = [...set.values()];\n        \n        for(let j = 0; j < values.length; j++) {     \n            str = `${values[j]}${arr[i]}`;\n            set.add(str);\n            let newStr = [...new Set(str).values()].join(\'\');\n            \n            if (str === newStr) {\n                max = Math.max(str.length, max);    \n            }            \n        }\n    }\n    \n    return max;\n};\n```\n
['JavaScript']