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.
Remove duplicate element from an array
Array.filter method, check each element's index is equal to the
indexOf value of the array.
Or in ES6 using set:
Reverse a string without native methods
Given a string, print the reverse of the string (ex:
Without native methods:
Find the missing number
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
Permutations of a string
Get all permutations of a string
Check sum of two
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