Skip to content

Instantly share code, notes, and snippets.

View cieltan's full-sized avatar

Billy cieltan

  • Brooklyn, New York
View GitHub Profile
@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).

@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 / buy&SellStocks.md
Last active December 21, 2021 00:24
Day 2 - AsyncAlgorithms

Best Time to Buy and Sell Stock


Interviewer Prompt

Say you have an array for which the ith element is the price of a given stock on day i.

If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit.

Note that you cannot sell a stock before you buy one.