Minimum Absolute Difference in an Array
Given an array of integers, find and print the minimum absolute difference between any two elements in the array. For example, Input: -59 -36 -13 1 -53 -92 -2 -96 -54 75 Output: 1...
Given an array of integers, find and print the minimum absolute difference between any two elements in the array. For example, Input: -59 -36 -13 1 -53 -92 -2 -96 -54 75 Output: 1...
Input: [“3”, “1”, “+”, “5”, “*”] Output: 9 Explanation: ((3 + 1) * 5) = 20 Algorithm: The key thing to realize in this to use stack as a data structure for the solution....
Problem : Given list l1 = 1->2->3. And list l2 = 10->20->30. Generate a new list mergedList = 1->2->3->10->20->30. Given list l1 = 1->3->4. And list l2 = 1->2->3. Generate a new list mergedList...
Different ways to track the max value while iterating over different values We can use if, ternary operator or Math.max function as shown below. if (val > max) { max = val...
Problem You are given an a string of characters including duplicates. You need to find the first non-repeating / unique character. input: foobar output: f input: aabbccdef output: d input: aabbcc output: ‘No Unique...
Problem You are given an array of objects each with its name and timeout value. Iterate over each element inside an array in the interval of the given timeout. Solution We have to set...
Problem statment There are two people on different sides of the bridge. The only way they can communicate is via Flash lights. One person wants to communicate the numbers, came up with roll of...
Gauging candidates knowledge of Javascript, HTML, CSS skills in less than an hour is certainly a challenging task. It is almost impossible to calibrate candidates success at the company by asking technical questions. If...
Implement the Function.prototype.bind function in javascript bind allows you to change the scope of this also allows you to create functions when called are prefixed with arguments as shown in the solution (aka currying,...
Fix the following function. When you click on a node, an alert box is supposed to display the ordinal of the node. But it always displays the number of nodes + 1 instead. [codepen_embed...