# Month: January 2021

## Invert Binary Tree

Inverting a Binary Tree is a problem asked in a lot of interviews and we will be tackling it in a simple but efficient manner. Any tree-related problem should be attempted to be solved in a recursive approach since Tree is a localized data structure i.e small trees make up large trees.

## Isomorphic Strings

Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character may map to itself.

## Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

## Set Matrix Zeroes

Given a matrix, A of size M x N of 0’s and 1’s. If an element is 0, set its entire row and column to 0.

## Maximum Subarray Sum

Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.

## Count Complete Tree Nodes

Given a Complete Binary Tree, count the number of nodes. Definition of a Complete Binary Tree: In a Complete Binary Tree every level, except possibly the last, is completely filled, and all […]

## K Closest Points to Origin

Given a list of points on the plane. Find the K closest points to the origin (0, 0). The distance between two points on a plane is the Euclidean Distance.

## Next Closest Time

Given a time represented in the format “HH:MM”, Form the next closest time by reusing the current digits. There is no limit on how many times a digit can be reused. You may assume the given input string is always valid. For example, “01:34”, “12:09” are all valid. “1:34”, “12:9” are all invalid.

## Maximum Number of Events That Can Be Attended

Let’s say we had a calendar for a four day week. The calendar is full of events, which each can span multiple days. Each color block represents an event:

## Search for a target value in a 2D Matrix

Write an efficient algorithm that searches for a value in an m x n matrix