[Programming Problem] Surrounded Regions

Given an m x n matrix board containing ‘X’ and ‘O’, capture all regions that are 4-directionally surrounded by ‘X’. A region is captured...

[Programming Problem] K Closest Points to Origin

Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane and an integer k, return the k...

[Programming Problem] Minimum Path Sum

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of...

[Programming Problem] Verifying an Alien Dictionary

In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some...

[Programming Problem] Design Tic-Tac-Toe

Assume the following rules are for the tic-tac-toe game on an n x n board between two players: – A move is guaranteed to...

[Programming Problem] House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint...

[Programming Problem] Paint Fence

You are painting a fence of n posts with k different colors. You must paint the posts following these rules: Every post must be...

[Programming Problem] Time Based Key-Value Store

Create a timebased key-value store class TimeMap, that supports two operations. set(string key, string value, int timestamp) Stores the key and value, along with...

[Programming Problem] Boundary of Binary Tree

Given a binary tree, return the values of its boundary in anti-clockwise direction starting from root. Boundary includes left boundary, leaves, and right boundary...

[Programming Problem] Deepest Leaves Sum

Given a binary tree, return the sum of values of its deepest leaves. Example 1: Input: root = [1,2,3,4,5,null,6,7,null,null,null,null,8] Output: 15 [Problem Link] Algorithm...