Algorithms

Unique-paths

A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only ...
Read More

Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins. For example, the ...
Read More

Check if string has all unique characters

Implement an algorithm to determine if a string (of characters from ‘a’ to ‘z’) has all unique characters or not ...
Read More

LRU Cache

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. get(key) - Get the ...
Read More

Trapping Rain Water

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water ...
Read More

Array VS Hash Table

Hash table tutorial Find element in Array function fuindInArray() { var t0 = performance.now(); for(var q = 0; q < ...
Read More
/ algorithms, java script, Uncategorized

Majority element in array

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times ...
Read More

Maximum Subarray

Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its ...
Read More
/ algorithms, java script, TUTORIALS

Plus One

Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that the most ...
Read More

Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: ...
Read More
/ algorithms, java script, Uncategorized