All Posts

Leetcode 199: Binary Tree Right Side View

You are given the root of a binary tree. Imagine yourself standing on the right side of the tree, and return the values of the nodes you can see when viewed from the right, ordered from top to bottom.

Leetcode 200: Number of Islands

You are given a 2D grid representing a map, where ‘1’ represents land and ‘0’ represents water. Your task is to count how many islands are formed by connecting adjacent lands horizontally or vertically. An island is a collection of ‘1’s connected either horizontally or vertically.

Leetcode 201: Bitwise AND of Numbers Range

Given two integers, left and right, representing a range [left, right], you need to calculate the bitwise AND of all numbers within that range, inclusive. The bitwise AND operation takes two numbers and returns a number where each bit is set to 1 if the corresponding bits of both numbers are also 1.

Leetcode 207: Course Schedule

You are given a set of courses and a list of prerequisites. Each prerequisite is a pair of courses where the second course must be taken before the first one. Determine if it is possible to complete all courses based on these prerequisites. If there are cycles in the dependencies, it would be impossible to finish all courses.

Leetcode 208: Implement Trie (Prefix Tree)

Implement a Trie data structure that supports inserting words, searching for exact matches, and checking if any word starts with a given prefix.

Leetcode 209: Minimum Size Subarray Sum

Given an array of positive integers and a target value, find the minimal length of a contiguous subarray whose sum is greater than or equal to the target. If no such subarray exists, return 0.