↳
tail recursive algo
↳
str1 = "Hi abc tm" len1 = len(str1) ln = len1 space = " " str3 = [] cnt = 0 while len1 !=0: if str1[len1-1]!=" ": len1 = len1-1 cnt = cnt + 1 if str1[len1-1]==" ": len2 = ln-cnt while len2 != ln: if str1[len2] != " ": print(str1[len2],end="") len2 = len2 + 1 else: break print(space,end="") cnt = cnt + 1 len1 = len1-1 len2 = ln-cnt while len2 != ln: if str1[len2] != " ": print(str1[len2],end="") len2 = len2 + 1 else: break Less
↳
In Core Javascript const str = 'Hi I am John" as "John am I Hi'; const reverseString = () => { let temp = ""; for (let i = str.length; i >= 0; i--) { temp += str.charAt(i); } return temp; }; console.log(reverseString()); Less
↳
<div> <ul> <li></li> </ul> </div>
↳
<div> <ul> <li> </li> </ul></div>
↳
<div> <ul> <li></li> </ul> </div>
↳
My answer: The long method finishes first and then short method executes and completes. Expected answer: The short method returns first! Less
↳
the short method returns first! is the right answer since two methods will run parallel. As javascript is async events handling. You may right if had quested him is the methods run in sequence. Less
↳
@Anonymous. It looks like you have not read the question well. It says that there is no setTimeout[) involved. If you have read the question, I have some questions for the answer that you provided. 1. Is asynchronous same as multithreading? I remember reading that JavaScript is single-threaded. 2. Suppose the short method depends on some value modified by the long method. As you said, lets suppose that the short method returns first even though it is next to the long method in sequence. In this case, how do you manage your program? Less
↳
Wat all rounds ??
↳
But Java script is given more improtance
↳
Which program u got to execute?
↳
inline & inline-block elements takes space upto their content width. The main difference is inline element does not respect any dimensions given to them but inline-block does. Less
↳
It was behavioural like why do you think you are suitable for this position? Explain one critical situation you handled during your working with your last job. There were three questions only in video interview Less
↳
What was the third question for the behavioral part?
↳
Some Correction : It will print 4 times "4". Fix: just use "let"(block scope) rather than "var" It should be : console.log(a[i]) to print (1,2,3,4) Less
↳
My Answer : var a =[1,2,3,4] for (var i=0; i
↳
Yes, ofcourse, it'll print 4 times 4 (not 5 times). Another way could be: using closure function. var a = [1,2,3,4] for (var i=0; i Less
↳
3 divs in same row Ans: <div> <div>C1</div> <div>C2</div> <div>C3</div> </div> .Row { display: table; width: 100%; /*Optional*/ table-layout: fixed; /*Optional*/ border-spacing: 10px; /*Optional*/ } .Column { display: table-cell; background-color: red; /*Optional*/ } Less
↳
Sample div { display : inline-block; } <div> <div>C1</div> <div>C2</div> <div>C3</div> </div> Less
↳
Sample div { display : inline-block; } <div> <div>C1</div> <div>C2</div> <div>C3</div> </div> Less