# Category: Intermediate

## Evaluate Reverse Polish Notation in Javascript

Input: [“3”, “1”, “+”, “5”, “*”] Output: 9 Explanation: ((3 + 1) * 5) = 20 Algorithm: The key thing to realize in this to use stack as a data structure for the solution....

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

## Delete all the nodes from a binary tree

Recursive : To delete all the nodes, you will have to visit all the nodes. There are three ways to traverse the binary tree : Post order Pre order In order. To delete all...

## what does console.log.bind(console) do?

Function#bind allows you to create a new function, whose this value will be set to the value you pass.   Hence, itÂ allows you to abstract the console.log statements. So, you can type : var...

## Find duplicates in an array using javascript

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

## Create a bar chart from json

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

## Implement twit box word limiting feature

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

## Tower of hanoi

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

## Detect start of a loop in linked list

Problem : Given a linked list, implement an algorithm which returns the node at the beginning of the loop. This post is a follow-up of – JavaScript Linked List Example – Detect a loop...

## Find loop length in a cyclic/circular linked list

Input : A linked list Output: An integer This post is a follow-up of – JavaScript Linked List Example – Detect a loop in cycliccircular linked list. I recommend reading those posts first, as...