ecdemis123 / toy-problems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

toy-problems

collection of coding challenges

  1. Rock Paper Permutation Given a number of rounds n, return all the possible rock-paper-scissors play possibilities for that number of rounds.

  2. All anagrams Given a single input string, write a function that produces all possible anagrams of a string and outputs them as an array. At first, don’t worry about repeated strings. What time complexity is your solution?

  3. Balanced Parenthesis Given a string, return true if it contains balanced parenthesis ().

  4. Common Characters Write a function that accepts two strings as arguments, and returns only the characters that are common to both strings.

Your function should return the common characters in the same order that they appear in the first argument. Do not return duplicate characters and ignore whitespace in your returned string.

Example: commonCharacters('acexivou', 'aegihobu')

Returns: 'aeiou'

  1. Coin Sums In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:

1p 2p 5p 10p 20p 50p £1 (100p) £2 (200p) Given a given number of pence, return the possible number of ways someone could make change.

It is possible to make 5 pence in the following ways:

5 * 1p

3 * 1p + 1 * 2p

1 * 1p + 2 * 2p

1 * 5p In other words, find all the possible combinations of coins that sum to a given pence value.

  1. Linked List Implement a linked-list

  2. Largest Product Of Three Write a function that accepts an array of integers and returns the largest product possible from three of those numbers.

  3. Eventing Library Make an eventing system mix-in that adds .trigger() and .on() to any input object.

  4. Common Ancestor Implement the function getClosestCommonAncestor and getAncestorPath in the Tree class

  5. One Away Given a string write a functin to check if they are one or zero edits away

  6. Zero Matrix Write an algorithm such that if an element in an MxN matrix is zero, the entire row and column will be zero

  7. Palindrome Permutation Given a string, write a function to check if the string is a Permutation of a palindrome.

  8. String Rotation Assume you have a method isSubstring which checks if a word is a substring. Given two strings, see if the second string is a rotation of the first string

About


Languages

Language:JavaScript 100.0%