Skip to content

Instantly share code, notes, and snippets.

@mmloveaa
mmloveaa / Smallest multiple
Last active December 27, 2015 19:12
Smallest multiple
// 12/23/2015
// Smallest multiple
// Problem 5
// 2520 is the smallest number that can be divided by each of the numbers from
// 1 to 10 without any remainder.
// What is the smallest positive number that is evenly divisible by all of the
// numbers from 1 to 20?
@mmloveaa
mmloveaa / A function to display Mottos for Westerosi Houses
Last active December 27, 2015 19:11
A function to display Mottos for Westerosi Houses
// 12/23/2015
// A function to display Mottos for Westerosi Houses
// Given a list of the following major Houses of Westeros
// and their respective mottos:
// var houses = [
// {name: "Targaryen", motto: "Fire and Blood"},
// {name: "Stark", motto: "Winter is Coming"},
// {name: "Bolton", motto: "Our Blades Are Sharp"},
@mmloveaa
mmloveaa / Word Search
Last active December 27, 2015 19:11
Word Search
@mmloveaa
mmloveaa / CubeSummation
Last active December 27, 2015 18:05
CubeSummation
// 12/27/2015
// Write a function cubeSum(n, m) that will calculate a sum of cubes
// of numbers in a given range, starting from the smaller
// (but not including it) to the larger (including).
// The first argument is not necessarily the larger number.
// Examples:
// Test.expect(cubeSum(5,0) == 225, "cubeSum(5,0) should be 225");
// Test.expect(cubeSum(2,3) == 27, "cubeSum(2,3) should be 27");
@mmloveaa
mmloveaa / Students' names list
Last active December 27, 2015 18:05
Students' names list
// 12/27/2015
// You are a professor in high school. Summer holidays are over and you have
// been given many different lists containing your new students' names. It's
// your responsability to put all these lists together, in ascending order in
// the alphabet, so you can get organized in a more efficient way.
// As a computer programmer in your free time, you decided to write a program
// that would do what you need.
// Your task
@mmloveaa
mmloveaa / Find something in an Array
Last active December 27, 2015 18:04
Find something in an Array
// 12/27/2015
// Create a find function that takes a string and an array. If the string is
// in the array, return true.
// For example:
// find("hello", ["bye bye","hello"]) // return true
// find("anything", ["bye bye","hello"]) // return false
// Note: Hello != hello, case-sensitive.
@mmloveaa
mmloveaa / nthChar
Created December 27, 2015 19:05
nthChar
// 12/27/2015
// Function nthChar takes 1 parameter - an array of n words.
// You must concatenate the nth letter from each word to construct a new word
// which should be returned as a string.
// Note: Test cases contain valid input only - i.e. a string array or an empty
// array, each word will have at least as many letters as its ordinal position.
@mmloveaa
mmloveaa / Car Depreciation
Last active December 27, 2015 21:18
Car Depreciation
// 12/27/2015
// Car Depreciation
// You own a great car website that helps people make decisions about buying
// the best new car for them. You decide that if you had a calculator on the
// website which lets people know their car's value after depreciation in a
// couple of years, would be a great idea!
// Write a function that takes the car's value when new (p) and return its
// value to 2 decimal places in the nth year (n).
@mmloveaa
mmloveaa / Sum of all arguments
Created December 27, 2015 22:10
Sum of all arguments
// 12/27/2015
// Sum of all arguments.
// Calculate the sum of all the arguments passed to a function.
// Note: If any of the arguments is not a finite number the function
// should return false/False instead of the sum of the arguments.
// For example:
@mmloveaa
mmloveaa / +1 Array
Last active January 4, 2016 22:29
+1 Array
// Started on 12/27/2015, Got back to this question on 1/4/2016
// +1 Array
// Given an array of integers of any length, return an array that has 1 added
// to the value represented by the array.
// For example an array [2, 3, 9] equals 239, add one would return an
// array [2, 4, 0].
// [4, 3, 2, 5] would return [4, 3, 2, 6]