## find pivot in an sorted rotated array

Problem : Given a sorted and rotated array find the index of a pivot element in an array. Input : An array Output : An index Algorithm : Binary search tree Time complexity :...

Skip to content# Monthly Archive: January 2016

## find pivot in an sorted rotated array

## Dedupe an array in javascript

## Find duplicates in an array using javascript

## Algorithm: find unique characters in a string using javascript

## Create a bar chart from json

## Implement twit box word limiting feature

## Queue using two stacks javascript

## Sort the stack in ascending order

## Tower of hanoi

Problem : Given a sorted and rotated array find the index of a pivot element in an array. Input : An array Output : An index Algorithm : Binary search tree Time complexity :...

Input : An array Output : An array Logic : Iterate over the input array called data Add the element to the output array called result if the element does not exist in the...

Problem : Given an array of positive integers find all the duplicate elements. Algorithm : Iterate over the array using forEach Find if there is a duplicate for the element using indexOf indexOf takes...

Problem : Given a string find all the unique characters in the stirng. Input : A string Output : A string Logic : Iterate over entire string and create a frequency map If the...

Problem : Given a JSON data structure with key representing age and value representing the number of people with that age. For example, { 25: 55, 26: 45, 27: 10, 28: 20, 30: 1,...

Problem : Implement a twitter like twit-box component which limits the feed to 140 characters. Logic: If the length of the string is greater than 140 characters If the 141th character is a space...

Problem : Implement queue’s enqueue and dequeue operations using two stacks. Logic: The queue is first-in-first-out and a stack is last in-first-out phenomena. Hence, the main difference between these two data structures is that...

Problem : Sort the given stack into an ascending order without using recursion. Logic: Pop an item from the original stack and push it onto the sorted stack. If the poped item from the...

Problem : The Towers of Hanoi is a classic puzzle with 3 pegs and multiple disks of different sizes. The goal of the puzzle is to move all the disks from the first peg...