Skip to content

Instantly share code, notes, and snippets.

View edwardhaddican's full-sized avatar

Edward Haddican edwardhaddican

View GitHub Profile

The People's Smoothie

Create a class Smoothie and do the following:

MDN DOCUMENTATION FOR CLASSES: HERE

  • Create a constructor property called ingredients.
  • Create a getCost method which calculates the total cost of the ingredients used to make the smoothie.
  • Create a getPrice method which returns the number from getCost plus the number from getCost multiplied by 1.5. Round to two decimal places.
  • Create a getName method which gets the ingredients and puts them in alphabetical order into a nice descriptive sentence. If there are multiple ingredients, add the word "Fusion" to the end but otherwise, add "Smoothie". Remember to change "-berries" to "-berry". See the examples below.

A List of Potential Post Graduation Projects

Below are a few project suggestions, but note that there are many options! Feel free to do some research into additional projects or tools that you're interested in. At the end of the day, just make sure you are coding!

Finish Grace Shopper

As a group

  • Continue assigning work to each member as you have been doing
  • Meet for regular stand ups at least once a week
  • Remember to maintain the health of your github repository with regular merges and pull requests into main

Unique Paths


Interviewer Prompt Thanksgiving Version:

A turkey is located in the top-left corner of a m x n table (grid). It can either move down one rows or to the right one space with each step. You want the turkey to reach your plate, at the bottom-right corner of the table. How many possible unique paths can the turkey take to reach your plate?

String Permutations

Prompt

Given a string, return an array of all the permutations of that string. The permutations of the string should be the same length as the original string (i.e. use each letter in the string exactly once) but do not need to be actual words.

The array that is returned should only contain unique values and its elements should be in alphabetical order.

Examples

@edwardhaddican
edwardhaddican / 02-river-sizes.md
Last active August 20, 2020 18:55
River Sizes

River Sizes

Interviewer Prompt

You are given a two-dimensional array (a matrix) of potentially unequal height and width that contains only values of 0 and 1. Each 0 represents land, and each 1 represents part of a river. A river consists of any number of 1s that are either horizontally or vertically adjacent, but not diagonally adjacent. The number of adjacent 1s forming a river determine it's size.

Write a function that returns an array of the sizes of all rivers represented in the input matrix. The sizes do not need to be in any particular order.

Examples

const matrix = [
@edwardhaddican
edwardhaddican / 02-merge-n-ll.md
Last active August 14, 2020 14:24
Merge N Sorted Linked Lists

Merge N Sorted Linked Lists

Interviewer Prompt

Write a function that takes in the heads of N sorted Singly Linked Lists and return the merged list. The merged list should be in sorted order.

Each Linked List node has an integer value as well as a next node pointing to the next node in the list or to none / null if it is the tail of the list.


Array Three Sum

Interviewer Prompt

Given an array of distinct integers and an integer representing a target sum, write a function that returns an array of all triplets in the input array that sum to the target sum.

Examples

arrayThreeSum([12, 3, 1, 2, -6, 5, -8, 6], 0)   //should return [[-8, 2, 6], [-8, 3, 5], [-6, 1, 5]]
arrayThreeSum([5, 6 , 1, -9 , 7, 3 , 2], 35) //should return []
@edwardhaddican
edwardhaddican / 01-palindrome-check.md
Last active January 7, 2021 02:09
Palindrome Check REACTO

Palindrome Check

Interviewer Prompt

Given an string str, create a function that returns a boolean, corresponding to whether that string is a palindrome (spelled the same backwards and forwards). Our palindrome check should be case-insensitive.

Examples

isPal('car') => false

Unique Paths Problem

A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).

The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).

How many possible unique paths are there?