Skip to content

Instantly share code, notes, and snippets.

@evelynlatour
evelynlatour / string-search-REACTO.md
Last active November 7, 2018 01:58
String Search

String Search (indexOf())


Prompt

  • Given a 2 strings as input, write the function indexOf(needle, haystack) that returns the index of the first appearance of the first string (the needle) inside the second (the haystack).

  • DO NOT USE built-in string methods like indexOf(), includes() or substring()

Prompt: Rain Water Collector

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. Unfortunately, your collection device isn't flat.

Given n non-negative integers in an array representing an elevation map, compute how much rain water your collection device can hold. The width of each bar is 1.

Example

@evelynlatour
evelynlatour / treeTraversal.md
Last active September 18, 2018 21:30
Reacto for 9/19/18: Tree Traversal

Tree Traversal


Instructions

Today you will write some different iterator functions for traversing trees:

  1. breadthFirst