Author: Kavit

Find the first unique character in a given string or an array

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...

Loop over an array with the given timeout for each element

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...

Create a protocol to transmit numbers efficiently or Huffman coding puzzle

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...

Top 10 Interview Questions for Front-end, Web, ui, JavaScript Developers

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 bind function in javascript

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 solutution Solution

Fix a function that assigns event handler functions to an array of nodes the wrong way

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...

Function which returns a function javascript

Problem Implement the compound function which returns a function and satisfies the following condition function add10 (a) { return a + 10 } console.log(add10(10)) // 20 console.log(compound(add10)(10)) // 30 Solution

function that returns a function until called without arguments in javascript

Write a function say which logs the following. console.log( say(‘Foo’)(‘bar’)() ) // => “Foo bar ” console.log( say(‘Hi’)(‘my’)(‘name’)(‘is’)(‘Foo’)() ) // “Hi my name is Foo ” Note: Solution does not use recursion. There is...

increment an integer array by one

Problem Given an integer array, increment its numeric value by one. For example, increment([2, 7, 3]) returns [2, 7, 4] Solution

Find target subtraction is possible in a given unsorted array of numbers

Problem statment Given an array of unsorted numbers and a target element. Find if any two elements subtract to the target element or not. You can loop through the array only once. Constraint: Time...