Skip to content

Instantly share code, notes, and snippets.

View dongledan's full-sized avatar
💦
Drink more water

Danny Li dongledan

💦
Drink more water
View GitHub Profile
@itsmattsoria
itsmattsoria / gistfil1.textile
Last active July 3, 2024 05:36
Mac Terminal Cheat Sheet

SHORTCUTS

Key/Command Description
Tab Auto-complete files and folder names
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + U Clear the line before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + W Delete the word before the cursor
Ctrl + T Swap the last two characters before the cursor

class: center, middle

String Search

(ie indexOf)


Prompt

@cieltan
cieltan / treeTravesal.md
Created August 6, 2019 19:23
treeTravesal

Tree Traversal


Interviewer Prompt

Today you will write a series of iterator functions for trees.

  • breadthFirst
  • depthFirstPreOrder
@cieltan
cieltan / Intersection.md
Last active September 8, 2019 21:20
Intersection

Intersection


Prompt

Given two sorted arrays of numbers, return an array containing all values that appear in both arrays. The numbers in the resulting array (the "intersection") may be returned in any order, they needn't be sorted.

You can assume that each array has only unique values (no duplicates within the array).

OOP Design

OOP Design is a good exercise on how to split up our system into different objects/classes. The main difficulty with problems like these are that they are open-ended and force you to think abstractly and creatively. One of the other main goals of this exercise is to be able to draw out diagrams to help with communicating abstract ideas before they are implemented in code. These problems are language agnostic.


Design an ATM

PROMPT: Using object oriented programming principles, class diagrams and activity diagrams, design an ATM.

We are being explicit here, however, you might not get this luxury from an interviewer as they might just ask, "Using object oriented design, design an ATM".

Curry


Interviewer Prompt (a)

Currying is the process by which a function of N arguments is implemented as N single-argument functions such that first of them takes in the first argument and returns a function which takes in the 2nd argument and so on, until the Nth single-argument function finally returns the value of the multi-argument function being implemented.

Your Task:

Slides


Prompt

You're an industrious programmer that lives off the grid. The local well that you use to fetch water has gone dry, so you've decided to collect rain water to filter; however, your collection device isn't flat.

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water your collection device is able to trap after raining.