Skip to content

Instantly share code, notes, and snippets.

Act IV:

Friar Laurence helps Juliet by providing a sleeping draught that will make her seem dead. When the wedding party arrives to greet Juliet the next day, they believe she is dead. The Friar sends a messenger to warn Romeo of Juliet's plan and bids him to come to the Capulet family monument to rescue his sleeping wife.

The vital message to Romeo doesn't arrive in time because the plague is in town (so the messenger cannot leave Verona). Hearing from his servant that Juliet is dead, Romeo buys poison from an Apothecary in Mantua. He returns to Verona and goes to the tomb where he surprises and kills the mourning Paris. Romeo takes his poison and dies, while Juliet awakens from her drugged coma. She learns what has happened from Friar Laurence, but she refuses to leave the tomb and stabs herself.

Act I:

Romeo and Juliet begins as the Chorus introduces two feuding families of Verona: the Capulets and the Montagues. On a hot summer's day, the young men of each faction fight until the Prince of Verona intercedes and threatens to banish them. Soon after, the head of the Capulet family plans a feast. His goal is to introduce his daughter Juliet to a Count named Paris who seeks to marry Juliet.

Montague's son Romeo and his friends (Benvolio and Mercutio) hear of the party and resolve to go in disguise. Romeo hopes to see his beloved Rosaline at the party. Instead, while there, he meets Juliet and falls instantly in love with her. Juliet's cousin Tybalt recognises the Montague boys and forces them to leave just as Romeo and Juliet discover one another.

Prompt

Given a staircase with a given number of stairs, num, write a function that returns the number of different ways one can climb this set of stairs. A person is able to climb the stairs either one at a time, or skip a step, or a mix of both.

Examples

climbStairs(2); // should return 2: one step at a time (1 + 1), or skip a step (2).
climbStairs(0); // should return 1
climbStairs(1); // should return 1
climbStairs(5); // should return 8
climbStairs(100); // should return 573147844013817200640

Prompt

Given an unsorted Linked List (singly linked), write a function that removes all additional duplicate values in the list.



Given

A prebuilt singly linked list will be written for us already, just as follows:

class LinkedList {

Prompt

Create a Doubly Linked List (each node has reference to both the previous and next nodes) with the following methods:

  • addToHead(value): this should add a node to the beginning of our list
  • addToTail(value): this should add a node to the end of our list
  • remove(value): this should remove the first node where the value is equal to our given value (from head to tail)
  • contains(value): this should return true if our list has a given value, false if not



Introduction

Let's take a look at one of the best classic games!

Super Mario Bros NES

(https://www.youtube.com/watch?v=ia8bhFoqkVE "Super Mario Bros Gameplay") (Watch from 0:00 - 1:00)

If you already understand the basics of how Super Mario works, feel free to skip to the prompt!

Prompt

Given a 2-Dimensional array (Essentially a grid), write a function that searches for all the values that equal 0 in the array, and then turns all values in the same row and column as the zero into other zeros.

In the event that there are no zeros in the input array, then simply return the input array.


Examples

Prompt

Given two strings, write a function that returns true if one string is a rotation of the other string. In this case, a string rotation is a string that is misplaced by one cut. And example would be: "goodbye" and "odbyego" -> these are a rotation of each other.

Premise

This is very similar to other string permutation problems where checking a character count is appropriate. In this case it would not accurately get the job done, so keep that in mind.


Rotate


Prompt

Write a function that takes a 2-Dimensional array of integers and returns a copy of that array rotated 90 degrees (clockwise). Are you able to do this in place? Note that these 2 Dimensional arrays will be squares, (N x N) with the same numbers of rows and columns.


One Away

Prompt

There are three types of edits that can be made to a string:

  • Replace: Replacing a single character with another character on the string
  • Insert: Inserting a single character into a string, making it 1 length longer
  • Removal: Deleting a single character from a string, making it 1 length shorter

Write a function that takes in two strings, and returns true if the two strings are one "edit" or zero "edits" away from each other (false if not).