Giter VIP home page Giter VIP logo

katas.js's Introduction

katas

Algorithm reviews

Basic String Compression

Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become a2blc5a3. If the "compressed" string would not become smaller than the orig- inal string, your method should return the original string.

node basic-string-compression.test.js

Best Profit

An array contains share prices, calculate the best profit (buying before selling) for a single buy and sell during the set of data.

node best-profit.test.js

Hannoi

In the classic problem of the Towers of Hanoi, you have 3 towers and N disks of different sizes which can slide on to any tower. The puzzle starts with disks sorted in ascending order of size from top to bottom (i.e., each disk sits on top of an even larger one). You have the following constraints:

  1. Only one disk can be moved at a time.
  2. A disk is slid off the top of one tower onto the next tower.
  3. A disk can only be placed on top of a larger disk.

Write a program to move the disksfrom the first tower to the last using stacks.

node hannoi.test.js

Two-stack Queue

Implement a Queue which implements a queue using two stacks.

node two-stack-queue.test.js

Binary Search Tree

Implement a binary search tree with methods to insert, remove and walk the tree in order.

node binary-search-tree.test.js

Heap

Create a Heap, implementing push and pop methods

node heap.test.js

Check Prime

How would you verify a prime number?

node is-prime.test.js

Bubble Sort

Implement a bubble sort

node bubble-sort.test.js

Fibonacci

Write a function to calculate the Nth number in the fibonacci sequence

node fibonacci.test.js

Reverse a String

Reverse a given string

node reverse-string.test.js

Prime Factors

Find all prime factors of a number

node prime-factors.test.js

Find all prime factors of a number, recursively

node prime-factors-recursive.test.js

Quick find in array

Suppose we had an array of n integers sorted in ascending order. How quickly could we check if a given integer is in the array?

node quick-find-in-list.test.js

Create an Emitter class

An Emitter class which can create subscriptions to named events and remove them. An emit method exists which will call each of the subscribed functions.

node event-emitter.test.js

katas.js's People

Contributors

pbrdmn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.