I will watch interviews from now on instead of watching tutorials. Thank you for uploading it as a post. For freshers, its not just a post its a potential unlocker video. Really helpful for upscaling the base knowledge. Respect++
People who copy and paste code have fun when this interview comes
Don't take it hard solve like a puzzle just split up the problem and solve the splited problem in code and merge the problem and merge the code boom you got it... in merge string just split problem two concate alternate string so you can use loop for minimum length string after run balance extra string we will concate it to final result using substring method...
//Marge two string let str1 = 'Hello' let str2 = 'World' //output = HWeolrllod; let bag = ''; let i =0;j=0; while(i<str1.length||j<str2.length){ if(i<str1.length){ bag+=str1[i] i++ } if(str2.length){ bag+=str2[j] j++ } } console.log(bag)
Bro.. the question of == and === came in the morning interview. Thanks 🤗
const str1 = "abc2"; const str2 = "xyz13"; function addString(str1, str2) { let minStr = Math.min(str1.length, str2.length); let res = ""; for (let i = 0; i < minStr; i++) { res += str1[i]; res += str2[i]; } str1.length > str2.length ? (res += str1.substring(minStr, str1.length)) : (res += str2.substring(minStr, str2.length)); return res; } const res = addString(str1, str2); console.log(res);
Student communication is Better then interviewer
const array = [1,[3,4],[6,[7,8]]] const stack = [...array] const res =[] while(stack.length){ const pope = stack.pop(); if(Array.isArray(pope)){ stack.push(...pope) }else{ res.push(pope) } } console.log(res.reverse()) //Flat array
20:00 Merge String alternately let s1 = "Hello123456"; let s2 = "World"; let finalStr = ""; for (let i = 0; i < (s1.length > s2.length ? s1.length : s2.length); i++) { if (i < s1.length) finalStr += s1.charAt(i); if (i < s2.length) finalStr += s2.charAt(i); } console.log(finalStr);
Bro continue this type interview it will really helpful.
Fantastic interview! Really helpful...
I guess Passing null will cause an error, because i guess react expects the dependency array to be an array or to none so Null won't be valid for it! The no dependency will cause it to run after every render and empty -once on mount
Bhai string marge wale question bhut aasan tha like 5 min me ho gya tha and bhut simple logic bhi tha, aapne kuch jada hi hard kar diya use or gor se deekho uska ans fir bhi glt hi aaya hai extra 'o' aaya hai usme , but bo bat hai ki thoda pressure environment ki bat ho jata hai, barna aap bhi bad me krke dekhte to badi aasani se ho jata
10:35 , it will give true
At 37:01, it's taking null value of str1 as undefined
function mergeStrings(param1, param2) { let mergeStr = ""; let maxlength = Math.max(param1.length, param2.length); let suffix = ""; let sortlength = Math.min(param1.length, param2.length); if (param1.length < param2.length) { suffix = param2.slice(param1.length, param2.length); } else { suffix = param1.slice(param2.length, param1.length); } for (let i = 0; i < sortlength; i++) { mergeStr = mergeStr.concat(param1[i], param2[i]); } if (suffix != "") { mergeStr = mergeStr.concat(suffix); } return mergeStr; } let str1 = "hello"; let str2 = "worldABC";
:hand-purple-blue-peace:so good video, I watched for 30 minutes and practiced and learned object and array concepts by these explanations
let a = 'Hello'; let b = 'World 1234'; function mergeStrings() { let res='' for(let i=0; i< b.length; i++) { if (a[i]) { res = res + a[i] } res = res + b[i] } return res } console.log(mergeStrings())
It’s good but this is planned interview i think but this is good way to present himself
@AmirKhan-uh5vd