This post contains some practical and commonly asked coding problems that can be found in any technical interviews. So be not surprised while facing them.
Array.filter method, check each element's index is equal to the
indexOf value of the array.
Or in ES6 using set:
Given a string, print the reverse of the string (ex:
Without native methods:
Given a unsorted array of numbers 1 to 100 excluding one number, find the missing number.
The sum of a linear series of
n numbers is equal to
Get all permutations of a string
From a unsorted array, check whether there are any two numbers that will sum up to a given number.
Another way of doing, have an object where we will store the difference of sum and element. And then when we get to a new element and if we find the difference is the object, then we have a pair that sums up to the desired sum.
For the given string, determine if the strings of brackets in the input is valid or invalid by these criteria.
"([)]" // false
"()" // true
The solution is
This post contains only a handful of examples from our recently published app JS Code Samples. This app contains many examples varying from variable scope to coding problems like these. You can download the app from the below link.