This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 12/26/2015 | |
// Create a function wordsearch(w) that searches to see whether a word w is present in the given text variable. | |
// Please note it has to be a full word | |
// Update: You must not modify the text variable! | |
// Example: | |
// Text - "what makes the desert beautiful, said the little prince is that somewhere it hides a well"; | |
// wordSearch(Text,"prince")--> true | |
// wordSearch(Text,"beautiful")--> true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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] |