Skip to content

Instantly share code, notes, and snippets.

@cylau1031
cylau1031 / Largest_Smaller_BST_Key.md
Created January 26, 2018 03:49
Largest Smaller BST Key

Largest Smaller BST Key

Given a root of a Binary Search Tree (BST) and a number num, implement an efficient function findLargestSmallerKey that finds the largest key in the tree that is smaller than num. If such a number doesn’t exist, return -1. Assume that all keys in the tree are nonnegative.

Analyze the time and space complexities of your solution.

Constraints

  • [time limit] 5000ms
  • [input] Node rootNode
  • [output] integer
@cylau1031
cylau1031 / debugging.md
Created October 30, 2017 20:28 — forked from glebec/debugging.md
Debugging

Debugging JavaScript Applications

A practical distillation for Fullstack Academy students

Faults in computer problems were theorized as far back as 1843, when Ada Lovelace noted of Babbage's Analytical Engine, "Granted that the actual mechanism is unerring in its processes, the cards may give it wrong orders." Almost 160 years later, NIST reported that software errors cost the US $59 billion annually. Clearly, some of the cards are wrong. However, unlike Grace Hopper's famous moth, most of the time the culprit is ourselves.

Debugging is a sanitization procedure consisting of:

  • Preventing bugs in the first place, through good practices and assistive tooling.
  • Detecting bugs when they first arise, through proper error handling and testing.