Git Product home page Git Product logo

coding-challenge's Introduction

Project Shift Coding Challenge

First of all, this isn't a pass/fail challenge - get as far as you can. Some may find this difficult and others may find it rudimentary. We are merely interested in seeing what previous experience you have. Please limit your use of google to syntax and now answers.

Problem 1

Write a function, that when invoked, alerts "Durham is awesome!"

Problem 2

Write some JavaScript that loops through the following bands array and alerts, "I love [bandName]", obviously with the current band name string replacing the [bandName].

const bands = ['Kiss', 'Aerosmith', 'ACDC', 'Led Zeppelin', 'Nickelback'];

Problem 3

In the above challenge, when the loop gets to 'Nickelback', alert, "I DON'T love Nickelback!", but still alert the previous message for all other bands.

Problem 4

Write some JavaScript that finds the average of the following array:

const array = [34, 203, 16, 46, 34, 432, 342, 124, 33, 188, 12];

Problem 5

Write some JavaScript to find the MOST frequent item, and the LEAST frequent item in the following array. The return should look like: The most frequent item is: b. The least frequent item is : d

const array = ['a', 'b', 'c', 'd', 'c', 'b', 'b', 'c', 'a', 'e', 'b', 'e'];

Problem 6

Imagine that you have two arrays, each with single letter strings in the arrays. For example:

['a', 'b', 'c', 'a', 'a', 'b', 'd'];
['a', 'b', 'b', 'a', 'e', 'c', 'c', 'g'];

Write some JavaScript to create a new array based on the overlapping items and the number of times the overlap occurs. For example, our new array would look like this:

['a', 'a', 'c', 'b', 'b'];

To explain further, the string 'a' appears 3 times in the frist array and 2 times in the second array. Therefore, there are only 2 overlaps. The string 'c' appears 1 time in the first array and 2 times in the scrond array. Therefore, there is only 1 overlap. The same pattern follows with 'b'. Our new array is based on those overlaps.

Problem 7

Imagine that you're wanting to withdraw cash from the bank to cover specific costs. You want to withdraw the exact dollar amount, using the largest bills possible. For example, if the cost you were trying to cover is $1,745, you would need to withdraw 17 $100 bills, 2 $20 bills and 1 $5 bill. We'll leave change (anything less than a dollar) out of it for the sake of the exercise.

To solve this, write a function that takes one argument, cost and returns an object with the bill breakdown. For example, the object returned for $1,744, would like look this:

{
  100: 17,
  20: 2,
  1: 4
}

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.