Skip to content

Instantly share code, notes, and snippets.

View drummonda's full-sized avatar

Andrew Drummond drummonda

  • Software Engineer
  • New York, NY
View GitHub Profile

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:

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 an an array of numbers, find the length of the longest possible subsequence that is increasing. This subsequence can "jump" over numbers in the array. For example in [3, 10, 4, 5] the longest increasing subsequence (LIS) is [3, 4, 5].

Examples

longestIncreasingSubsequence([3, 4, 2, 1, 10, 6]);
// should return 3, the length of the longest increasing subsequence:
// 3, 4, 6 (or 3, 4, 10)

class: center, middle

Intersection


class: center, middle

Prompt

@drummonda
drummonda / ImmutableBST.md
Created August 23, 2018 15:54 — forked from dmzobel/ImmutableBST.md
Immutable BST Algorithm

Slides

Immutable BST

Prompt

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: