This interesting interview problem was asked by Google.

A unival tree (which stands for “universal value”) is a tree where all nodes have the same value.

Given the root to a binary tree, count the number of unival subtrees.

## Counting Unival Subtrees

...moreThis interesting interview problem was asked by Google.

A unival tree (which stands for “universal value”) is a tree where all nodes have the same value.

Given the root to a binary tree, count the number of unival subtrees.

## How to Solve the Knight's Tour Problem

...moreLet’s work through the problem of the knight’s tour problem.

A knight’s tour is a sequence of moves by a knight on a chessboard such that all squares are visited once.

Given N, write a function to return the number of knight’s tours on an N by N chessboard.

## How to Formulaically Solve Tree Interview Questions

...moreTree questions are very common at top tech company interviews. I had two tree questions in my Google onsite interviews and one during my Facebook onsite interviews. An awesome thing about them is that they can be formulaically solved every single time. It doesn’t involve any genius insight. Let me show you how.

## An Introduction To Backtracking

...moreBacktracking is an effective technique for solving algorithmic problems. In backtracking, we search depth-first for solutions, backtracking to the last valid path as soon as we hit a dead end.

## How To Find Arbitrage Opportunities In Python

...moreHi there!

Let’s solve an interesting programming interview problem: how to find an arbitrage. Here’s the question.

Suppose you are given a table of currency exchange rates, represented as a 2D array. Determine whether there is a possible arbitrage: that is, whether there is some sequence of trades you can make, starting with some amount A of any currency, so that you can end up with some amount greater than A of that currency.

## How to Solve the Staircase Problem

...moreLet’s work through the following problem.

There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time.

Given N, write a function that returns the number of unique ways you can climb the staircase.

The order of the steps matters.## The Complete Guide To Getting A Full-Time Software Engineering Job

...moreThis post is targeted for people looking to get offers from large tech companies like Google, Facebook, Microsoft, Dropbox, Uber, Lyft, and Airbnb. This isn’t to say other companies aren’t interesting! It’s just that these companies’ interview processes are all straightforward (though not necessarily easy) and many people are interested in working for them.

## How to Pick a Random Element from an Infinite Stream

...moreLet’s work through the problem of uniformly picking a random element from a gigantic stream. This is a common interview question at companies like Google and Facebook.

## How To Solve a Hard Programming Interview Question

...moreLet’s go over the thought process for solving a tricky coding interview question. I often find it’s not enough to just be able to solve the question; you really need to vocalize your thought process. This shows that you’re a strong communicator and that you didn’t just get lucky solving this one problem.