Posts

The Nature of BST nodes …

Characteristics of the problem

  1. You can’t start out with the root (lowest common ancestor)
  2. This is really a traversal problem
  3. Each node has a range of values that it could contain which is from [min(leftSubtree), max(rightSubtree)].
    • Understanding this range means we know the possible children …

TODO

Intuitive Proof for …

Introduction

I found a few resources that I think did a decent job at explaining bits and pieces but not the full thing. This is also a tool for me to think things through as I go through the proof.

Leetcode solution with useful insights
Math stackexchange with useful insights
Neetcode’s …

Useful Code for Matrices

https://leetcode.com/problems/valid-sudoku/description/

How to iterate through chunks

When solving the following problem you also need to solve it for multiple subproblems. Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:

Each …

Spiral Matrix

Discovery Stage

Understanding the return condition

Although it’s always important to do determine what problem you’re trying to solve is; it’s especially crucial in the beginning process of leetcode. Mainly due to the reason you don’t want to solve a problem that is harder …

Leetcode 91: Decode Ways …

Why I like this problem

https://leetcode.com/problems/decode-ways/
A lot of the canonical recursive problems you start out with have really simple code. Things that come to mind are https://leetcode.com/problems/fibonacci-number/, https://leetcode.com/problems/climbing-stairs/ and …

Quarrel With Dynamic …

DP is an Art

Snapshot is clear, global is not

An issue I ran into with developing an intuition with dp is that in some cases the immediete solution is obvious yet I had a nagging sense of how could it be right long term. To explain my issue I’ll go through a leetcode problem. …

Choose Unchoose Pattern …

Pre Requisites

This post won’t elaborate on the following topics since there is already many great ones:

Context

This pattern is often just given as a part of a template …

Intro

Introduction

TODO