Skip to content

Instantly share code, notes, and snippets.

View tungsteno22's full-sized avatar
🔨

Nathan Avilez tungsteno22

🔨
View GitHub Profile

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.

Slides


Prompt

Write a function that determines whether an input string has balanced brackets.

You are given an input string consisting of brackets—square [ ], round ( ), and curly { }. The input string can include other text. Write a function that returns either true if the brackets in the input string are balanced or false if they are not. Balanced means that any opening bracket of a particular type must also have a closing bracket of the same type.

class: center middle

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:

Clock Minute Adder


Interviewer Prompt

Given:

  • a time in string format HH:MM
  • a number of minutes
@dustinheestand
dustinheestand / decimal-to-binary.md
Created November 19, 2018 18:37
Decimal-To-Binary & reverse

Decimal-To-Binary & reverse


Prompt

Write 2 functions, one that takes the a number in base 10 (decimal) and converts it to the string representation of that number in base 2 (binary), and one that converts back.

You may not use parseInt, toString, or any similar function which does base conversion for you.

Prompt

Given a target sum and an array of positive integers, return true if any combination of numbers in the array can add to the target. Each number in the array may only be used once. Return false if the numbers cannot be used to add to the target sum.

Examples

subsetSum(2, [1, 10, 5, 3]); // false
subsetSum(10, [1, 10, 5, 3]); // true
subsetSum(9, [1, 10, 5, 3]); // true

class: center middle

Priority Queue


Definitions

A queue is a data structure that stores pieces of data and returns them in the same order in which they were inserted. One way of implementing them is as a linked list.

A priority queue is a data structure that takes a priority value with each piece of data and returns the data in order of priority.

class: center, middle

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.

class: center middle

Dictionary Word Finder

<style> .remark-code { white-space: pre-wrap; } </style>

Tree Traversal


Interviewer Prompt

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

  • breadthFirst
  • depthFirstPreOrder