Git Product home page Git Product logo

benchmark-goal-15-coding-exercises's Introduction

#Benchmark goal - 15 coding exercises GuildCrafts/web-development-js#144

Description

Benchmark goals are projects that are designed to be done solo.

The specs of a benchmark goal are designed to cover a wide range of basic concepts and get progressively more complex. The specs are immutable. Benchmark goals do not affect your stats.

Context

Use a Benchmark goal to:

  • Take a break from pairing
  • Get a sense of what you can accomplish by yourself
  • Work on flexing problem solving skills
  • Assess how much you've learned/grown as a developer

Retrospectives, Reviews, Stats, and Team Size

Even though Benchmark Goals are solo goals, the project formation algorithm will add you to it in teams of two. Once that's done, the moderator will split up the team into two single-person projects. There will be no retrospectives for these projects.

For the project review, make sure to schedule a 1:1 30 minute meeting the following week with a SEP. They will go over the code with you in real time, and give you an in person completeness/quality review.

Testing

Come up with your own inputs and outputs (using the example inputs and outputs as well) and try to test with as many (reasonable) edge cases as you can.

Write your tests using the assert module in Node or whatever testing library you feel most comfortable with.

Specifications

1: Guess The Number

Write a program that will generate a number between 1 and 100. Your program will ask the user to guess the generated number.

When the user types a guess, the program should tell them if they won (the guess matched the computer's number), if their guess was higher than the number the computer generated, OR if the guess was lower than the number the computer generated. Terminate the program if the user types "exit".


2: Scrab-Bag

Scrabble (the game in which players remove tiles with letters on them from a bag and use them to create words on the game board) has a set number of 100 tiles.

This number does not change between games, nor does the frequency of each letter.

Frequency and point value of each tile.

Represent each tile by the letter that appears on it, and blank tiles by underscores (_).

Input:

An uppercase string with the tiles that have already been played.

E.g., if 14 tiles have been played, you would be given an input like this:

AERETOXMYCNS_B

Output:

The number of tiles remaining followed by a comma separated list of the tiles themselves.

For example:

10: E
9: I
8: A
7: O
5: R, N, T
4: U, L, D
3: G, S
2: P, H, F, V, W
1: B, Y, J, K, M, Q, C, Z, _
0: X

3: String Indices

Write a program that parses the words in a string by providing a numerical index, similar to how you would access an element in array with a numerical index.

Example:

"Catch me outside, how about that?"

If you asked for the word at index 3 you would get outside back (for the purposes of this challenge, our index will start at 1, not 0).

If you ask for the word at index 7, your program should return an empty string ('') because the string contains only 6 words. Negative indices should also return an empty string ('').


4: Fibonacci Bases

Binary (base 2) numbers use 1 and 0 to represent the powers of two that can be summed to yield a base 10 (or decimal) result.

For example:

16 8 4 2 1
1 0 1 0 1

10101 = 16 + 4 + 1 = 21

So 10101 is binary for 21.

The Fibonacci Sequence has a similar property: any positive integer can be written in the form of Fibonacci numbers.

For example:

21 13 8 5 3 2 1 1
0 1 1 0 0 0 0 0

1100000 = 13 + 8 = 21

So 1100000 is base Fibonacci for 21

Write a program that converts from decimal to base Fibonacci and from Fibonacci to decimal.

Example Inputs (the decimal and fib labels describe the state the number is currently in):

decimal 16 decimal 31 fib 10 fib 1 fib 11111

Example Outputs:

1001000 10100100 1 1 12

NOTE: there can be more than one possible representation of a decimal integer in base Fibonacci (as seen in the 3rd and 4th cases above).


5: The Disemvowling

Disemvoweling means removing the vowels (a, e, i, o, u) from text.

Input:

A string that contains several words to disemvowel. It will consist of all lowercase letters without punctuation. The only non a-z character you should handle is spaces.

Output:

The disemvowled text with spaces removed.

Example Input:

i am groot

Example Output:

mgrt


6: Where in the JSON?

{
    "name": "William Shakespeare",
    "dead" : true,
    "works" : [
        {
            "name" : "Romeo and Juliet",
            "published" : 1591,
            "isAwesome" : true
        },
        {
            "name" : "Richard III",
            "published" : 1592,
            "isAwesome" : false
        }
    ],
    "favoriteSites" : [
        "tumblr",
        "4chan"
    ]
}

If you wish to find the name of the first play in the list of Shakespeare's works, the "path" to it would look like like this:

works -> 0 -> name

You would say that the value located at this path is "Romeo and Juliet". The value "tumblr" is located at:

favoriteSites -> 0

Your task is to find a user-provided key hidden in a JSON object.

You will be given a JSON object, and you will print out the search path that leads to the value "4chan". You are allowed to use any JSON parsing libraries that you want to.

Input:

JSON object.

Output:

The search path for the string in the format shown above (each element should be joined together with -> between them.). Each element in the path will either be an integer (if indexing a list) or a string (if indexing an object).


7: Who Wants A Date?

According to ISO 8601 standard, the best way to format a date is:

yyyy-mm-dd

Learners Guild's database has become corrupted with mixed up date formats.

They can come in any of the 6 formats below:

yyyy-mm-dd
mm/dd/yy
mm#yy#dd
dd*mm*yyyy
(month in words) dd, yy
(month in words) dd, yyyy

(month in words) can be:

Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

Years are restricted to 1950-2049.

Input:

The 1000 dates in this gist.

Output:

All the dates in the yyyy-mm-dd ISO 8601 standard date format.


8: Play it again, JavaScript!

Create an application that plays that Do–Re–Mi–Fa–So–La–Ti of the Solfège.

**BONUS:**Play some chords.

Put the code into a JSBin instance to hear some sounds directly in your browser.

HINT: I'm just gonna leave this here.


9: Parens-B-Gone

(((7))) is an expression that contains too many parentheses.

How many is "too many" parentheses?

If you can strip the expression of one set of parentheses, and the same expression still contains parentheses, it has too many parentheses.

In the above example, (7) would be the proper stripping of parentheses.

Example Inputs:

((1((23)(45)))6)  

(((1234)(((5)67))))

12((3))

Example Outputs:

((1((23)(45)))6)  

((1234)((5)67))

12(3)

10: Resolving Symlinks

Many Unix-based systems support symbolic links (also known as symlinks). This is where one directory name is transparently mapped to another. Symbolic links can be used to 'redirect' one directory to another directory.

Your challenge is to resolve a given path name into its actual location given a series of symbolic links. Symbolic links can also point to other symbolic links.

Example Input:

1
/home/private/documents:/stuff/urgent/docs
/home/private/documents/office

Example Output:

/stuff/urgent/docs/office

Another Example Input:

3
/bin:/usr/bin
/usr/bin:/usr/local/bin/
/usr/local/bin/log:/var/log-2017
/bin/log/lib

Another Example Output:

/var/log-2017/lib

11: Lairotcaf

The factorial operator (!) describes the product of an integer and all the integers below it.

4! -> 4 * 3 * 2 * 1 -> 24

Write a function that does the reverse of this for any positive integer.

Example Inputs:

720

37

Example Output:

720 = 6!

37 NONE


12: String Me Along

Given an input string, print the longest substring that contains a maximum of two unique characters.

If there are multiple substrings that qualify as 'longest', print substring that is furthest to the right.

Examples:

ghhiiii -> hhiiii

efgefghiiikk -> iiikk

13: Braille

Your goal is to read in a string of Braille characters (definition here) and translate the word to standard English letters (you can ignore any special characters, including spaces).

A lowered bump is a dot ('.'), and a raised bump is an upper-case 'O' character.

Example Input:

O. O. O. O. O. .O O. O. O. OO
OO .O O. O. .O OO .O OO O. .O
.. .. O. O. O. .O O. O. O. ..

Example Output:

helloworld

14: String Permutations

Prints all of the permutations of the unique characters of an input string. For example, the permutation of the word "bar" would print the following:

bar
bra
abr
arb
rba
rab

15: Finite State Gate

You just installed a new remote controlled gate, and you're having a blast playing with the remote clicker.

The clicker works like this:

If the gate is OPEN or CLOSED, clicking the remote will cause the it to move, until it completes the cycle of opening or closing.

Gate: Closed -> remote clicked -> Gate: Opening -> Cycle complete -> Gate: Open.

If the gate is currently opening or closing, clicking the remote will make it stop where it is.

When clicked again, the gate will go in the opposite direction, until the cycle is complete or the remote is clicked again.

The gate starts CLOSED.

Example Input:

remoteClicked
cycleComplete
remoteClicked
remoteClicked
remoteClicked
remoteClicked
remoteClicked
cycleComplete

Example Output:

Gate: CLOSED
Remote clicked.
Gate: OPENING
Cycle complete.
Gate: OPEN
Remote clicked.
Gate: CLOSING
Remote clicked.
Gate: STOPPED_WHILE_CLOSING
Remote clicked.
Gate: OPENING
Remote clicked.
Gate: STOPPED_WHILE_OPENING
Remote clicked.
Gate: CLOSING
Cycle complete.
Gate: CLOSED

Stretch goals

  • Add more algorithms or data structure examples when finished with the 15 coding examples.

Required

  • The artifact produced is properly licensed, preferably with the MIT license.

Quality Rubric

To get a proper self assessment:

  • Start from scratch
  • Don't look at other repos
  • Understand and write every line of code
  • Ask for coaching sessions
  • Get frequent code reviews

benchmark-goal-15-coding-exercises's People

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.