All Posts

Leetcode 399: Evaluate Division

You are given a list of equations and their corresponding values, where each equation represents a division between two variables. Your task is to determine the result of several queries asking for the division result of two given variables.

Leetcode 406: Queue Reconstruction by Height

You are given an array of people, where each person is represented by two integers: their height hi and the number of people ki in front of them who have a height greater than or equal to hi. Your task is to reconstruct the queue based on these attributes.

Leetcode 416: Partition Equal Subset Sum

Given an integer array, determine if it is possible to partition the array into two subsets with equal sum. Return true if such a partition exists, otherwise return false.

Leetcode 417: Pacific Atlantic Water Flow

You are given an m x n grid representing an island, where each cell contains an integer representing the height above sea level. The island borders both the Pacific and Atlantic Oceans. The Pacific Ocean touches the left and top edges of the grid, and the Atlantic Ocean touches the right and bottom edges. Water can flow from one cell to an adjacent cell if the adjacent cell’s height is less than or equal to the current cell’s height. The task is to find all the cells where water can flow to both oceans.

Leetcode 419: Battleships in a Board

You are given a grid representing a battleship field, where ‘X’ marks the location of a part of a battleship and ‘.’ represents an empty sea cell. A battleship is either placed horizontally or vertically on the grid, with no adjacent battleships (there must be at least one empty cell between any two battleships). Your task is to count the number of distinct battleships on the grid.

Leetcode 421: Maximum XOR of Two Numbers in an Array

Given an array of integers, your task is to find the maximum result of the XOR operation between any two elements from the array. The goal is to maximize the XOR value of any pair of numbers in the array, where the XOR of two numbers is computed using the bitwise XOR operation.