# Category: Fundamentals

## Remove duplicates from the given array

Problem description : Write a function that removes duplicates entries from a given array. Input : An Array // [‘Heart5’, ‘Diamond6’, ‘Club7’, ‘Spade8’, ‘Diamond6’, ‘Club7’] Output : An Array // [‘Heart5’, ‘Diamond6’, ‘Club7’, ‘Spade8’]...

## Calculate the average of a nested array

Problem description: The following nested array contains some invalid entries (which are not numbers). We also want to filter those entries in our average calculation. var nestedArray = [ 1, 2, 3, [4, 5,...

## Multi dimensional arrays in javascript

Problem description : The following function creates a 2-D array and initialize it with zeros. Find a bug in the code and propse a solution to it. The following gist shows the given code...

## String compression using the counts of repeated characters.

Input : A string // aaaabbc Output : A string // a4b2c1 Logic : Iterate over the string Compare the current and next characters. If both characters are not same, Then increment the count...

## Reverse a given string, also using similar technique reverse a sentence without reversing words

Reverse a given string Input : A string // ‘Hello’ Output : A string // ‘olleH’ There are many ways of reversing a string. Approach 1 : Simplest way is to use inbuilt javascript...

## Determine if given strings are anagram.

Input : Two strings // ‘dog’, ‘god’ ; ‘foo’,’bar’ Output : Boolean // True ; False Clarifications : Is the comparison of our string permutation case sensitive? Yes Is whitespace significant? Yes Approach 1...

## Determine if a string has all unique characters

Input : A string Output : Boolean Clarifications : Is the input string ASCII or Unicode ? If ASCII then we need storage size of 128 bits Logic : Iterate over entire string If...