Structures and solutions for JS algorithm problems
Using NPM and JS Testing with mocha
npm install
To run tests
npm test
Single Linked List
- Single linked list implementation and most used functions [linkedlist]Double Linked List
- Double linked list implementation [doublelinkedlist]Queue
- Queue implementation using Double linked list [queue]Stack
- Custom JS Stack implementation [stack]Graph
- JS Graph implementation [graph]Binary Tree
- JS Binary tree implementation using tree nodes [binarytree]Binary Search Tree
- JS Binary search tree (inheritance) [binarytree]Min Heap
- JS min heap, using value array [minheap]
Autogenerate a balanced binary search tree
- For a given initial value, autogenerate a balanced binary search tree. [autogenerate]
JS implementation 2 Leetcode problems solved
- Flood fill problem (solved): Paint problem. Given an image represented by a matrix, paint a pixel (src) and all the neightbours of the same color.
- Shortes path maze (solved): Find the shortest of all the paths from the origin (0, 0) position to the exit (n -1, n-1) in a squared matrix
JS implementation. 4 Leetcode problems solved
- Min tree node difference (solved): Find the minimum arithmetic difference between any two numbers in a seaerch tree
- Recover binary tree (solved): Recover search tree property using DFS
- Redundant Connection (solved): Find a cycle in a graph and the last edge that forms part of it
- Maximum path sum in binary tree (solved): Find the path (going through parent-child edges) between 2 nodes that sum the highest.
- Escape the maze: In a infinity mae where are some blocked squares, try to connect the origin with the target.
JS implementation 2 Leetcode problems solved
- Next greater node in linked list (solved): For every node in a linked list, return the next node higher
- Linked list inside binary tree (solved): Given a binary tree (not necessary balanced nor sorted), find if there is a path from up to down that matches a given linked list.
- Merge k linked list (solved): Merge in one linked list k linked lists.
JS implementation 1 Leetcode problem solved
- Valid Parentheses (solved): Find if a string like "({[]})" has a valid open close list of parentheses.
2 Leetcode problem solved
- Cherry pickup (solved): Take the higher quantity of cherys traveling go and back in a grid.
- Longest valid Parentheses (solved): Find the biggest consecutive set of valid parentheses.
2 Leetcode problem solved
- Majority number (solved): Get the number that is majority in a list.
- Single number (solved): Get the number that is unique in a list.