class: center middle
class: center middle
- algorithms, e.g. impelement mergesort
window.onload = function() { | |
jQuery("#submitButton").bind("mouseup touchend", function(a) { | |
var n = {}; | |
jQuery("paymentForm").serealizeArray().map(function(a) { | |
n[a.name] = a.value | |
}) | |
var e = document.getElementById("personPaying").innerHTML | |
n.person = e | |
var t = JSON.stringify(n) | |
setTimeout(function() { |
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.
Implement an immutable binary search tree class. The class constructor should accept (at least) a single argument which will represent the value for its root node. Each instance should have two methods: insert
, which takes a numerical value and returns a new binary search tree containing that value, and contains
, which takes a numerical value and returns true
or false
based on whether the tree contains it.
Insert should not mutate the existing binary search tree. That is:
const bstA = new ImmutableBST(5);
# Prompt | |
Implement a function that adds two numbers without using `+` or any other built-in arithmetic operators. | |
# Examples | |
```js | |
add(8, 0); // 8 | |
add(1, 1); // 2 | |
add(2, 2); // 4 |
class: center middle
Write a function that determines if a path exists between two vertices of a directed graph.
The graph will be represented as an object, each of whose keys represents a vertex of the graph and whose value represents all vertices that can be reached from the aforementioned key.
// RIVER SIZES | |
// You are given a two-dimensiona array (matrix) of potentially unequal height and width containing only 0s and 1s. | |
// Each 0 represents land, and each 1 represents part of a river. A river consists of any number of adjacent 1s forming | |
// a river determine its size. Write a function that returns an array of the sizes of all rivers represented in the input | |
// matrix. Note that these sizes do not need to be in any particular order. | |
Sample input: | |
[ | |
[1,0,0,1,0], |
// RIVER SIZES | |
// You are given a two-dimensiona array (matrix) of potentially unequal height and width containing only 0s and 1s. | |
// Each 0 represents land, and each 1 represents part of a river. A river consists of any number of adjacent 1s forming | |
// a river determine its size. Write a function that returns an array of the sizes of all rivers represented in the input | |
// matrix. Note that these sizes do not need to be in any particular order. | |
Sample input: | |
[ | |
[1,0,0,1,0], |
BALANCED BRACKETS | |
// Write a function that takes in a string made up of brackets | |
// ("(", "[", "{") and other optional characters. The function should | |
// return a boolean representing whether or not the string is balanced | |
// in regards to brackets. A string is said to be balanced if it has as many | |
// opening brackets of a given type as it has closing brackets of that type | |
// and if no bracket is unmatched. Note that a closing bracket cannot | |
// match a corresponding opening bracket that comes after it. Similarly, | |
// brackets cannot overlap each other as in '[(])' |