2 Approaches for your interview(hindi)
Approach 1 : Brute \n\nvar longestConsecutive = function(arr) {\n\n        if(arr.length==0) return 0\n\n        let count=1, max = 1\n        arr.sort((a, b) =
### Approach 1 : Brute \n```\nvar longestConsecutive = function(arr) {\n\n        if(arr.length==0) return 0\n\n        let count=1, max = 1\n        arr.sort((a, b) => a - b)                       // Step1:  Sort karo\n\n        for(let i=0; i<arr.length; i++) {\n\n            if(arr[i]- arr[i-1] == 1) {                 // Step2 : Aur dekho ki, [mai - mere_se_pichla_elem == 1?]\n                count=count+1 ;                         //         hua, toh bas count kr lo \n                max = Math.max(max, count)              //         count krne ke saath saath,  maxLength bhi note krte jaa rhe hum\n                                                        //         Ek time aisa ayega, ki, consecutive ginn\'ne ka streak tut jyega, aur count phirse apne ko 1 se suru krna pdega \n                                                        //         example : [1 2 3 4 6 7]\n                                                        //                   isme 1234 ka streak rhega, phir 6 pe tut jyega\n                                                        //                   toh 1234 ke liye count aur max dono = 4. \n                                                        //                   6 pe tuta, so, count became 1 (look in else condition)\n                                                        //                   so, 67 ke liye, count=2 , aur max = Math.max(4{from 1234}, 2{from 67})\n            } \n    \n            else if(arr[i]==arr[i-1]) continue          // yeh step LEARNING hai tere liye. nahi toh tu toh SET laga rha tha duplicate hataane ke liye\n      \n            else {\n                count = 1\n            }\n           \n        }\n        return max\n};\n```\n<br> <br> <br> <hr> <hr>\n\n\n### Approach 2 : Optimised\n```\n\nvar longestConsecutive = function(arr) {\n\n    if(arr.length<=0) return 0\n\n    let map = new Map()\n\n\n    // STEP1 : MAP MEIN SABKO SEQ INITIATOR ASSUME KRKE, TRUE SET KARO\n    for(let elem of arr){\n        map.set(elem, 1)            // map  bithaa ke, sabko True set kr diya\n                                    // mtlb, assume yeh kr rhe hum abhi ki\n                                    // harr ek elem, kisi sequence ki suruwaat hai (thats false, we do know that ;)  )\n    }\n\n\n\n    // STEP2: YEH DEKHO KI, ISSE PEHLE WALA KAHI PRESENT TOH NAHI HAI MAP MEIN\n    for(let i in arr){              \n        if(map.has(arr[i]-1)) {     // ab , ARRAY mein loop laga ke yeh dekh rhe ki\n                                    // KYA, isse pehle wla numeric number, Map mein already pada hai ?\n                                    // agar hai, toh YEH TOH SURUWAAT nahi ho skta\n                                    // suruwaat kaise hoga yeh. inbetween wala kuch elem hoyega\n                                    // example: 4 ke liye check kr rhe, KYA 3 map mein pada hai ?\n                                    //          agar hai, mtlb, suruwaat probably 3 hoyega na. 4 toh nahi hoga na suruwaat\n\n            map.set(arr[i], 0)      // hence, agar pada hai, toh isko FALSE set kr do.\n        }\n    }\n\n\n\n                                    // ab TRUE woh log reh gaye, jo sacchi kisi sequence ki suruwaat hai\n                                    // example :  [1234] [100] [200] yeh sequence bann rhi thi initially,\n                                    //            toh 1->TRUE\n                                    //              100->TRUE\n                                    //              200->TRUE mila hai sacchi ka opne ko.\n                                    //\n                                    //  so sequence intiator sab mil gaye,\n                                    //  ab yeh dekhte hai, ki kaunsa sequence intiator, sabse badaa sequence generate krta hai\n                                    //  lets count\n\n\n\n\n\n\n    //STEP3: AB SAB SEQ INITIATORS KI LENGTH CALC KRO \n    let maxLen=1\n    for(let elem of arr) {\n        if(map.get(elem)==1) {                           // TRUE walo ko liye, sequence ki length dhundhenge\n\n            let seqCount = 1                             // sab element pkka se, kisi sequence ke initiator hai yaha ab. so pehle se hi count=1 set kr diya h (asaani ho rha tha aise coding krne mein)\n            while(map.has(elem + seqCount)) {            // jab tak sequence badhta rhe,\n                seqCount+=1                              // count krte raho\n            }\n\n            maxLen = Math.max(maxLen, seqCount)          // jab sequence bdhna khatam ho jaaye, tab maxLen ko update kr do (agar seqCount badaa mila apne ko toh )\n\n        }\n\n    }\n\n\n\n    \n    return maxLen\n    \n\n};\n\n\n```
['Python', 'C++', 'Java', 'JavaScript']