All Posts

Leetcode 954: Array of Doubled Pairs

Given an integer array of even length, determine if it is possible to reorder the array such that for every index i, arr[2 * i + 1] = 2 * arr[2 * i] holds true. If it is possible to reorder the array in this way, return true, otherwise return false.

Leetcode 955: Delete Columns to Make Sorted II

You are given an array of strings, where each string is of the same length. You are allowed to delete any number of columns, and after deleting the selected columns, the remaining strings should be in lexicographically non-decreasing order. Your task is to determine the minimum number of columns that must be deleted to achieve this order.

Leetcode 957: Prison Cells After N Days

You are given a row of 8 prison cells, where each cell is either occupied or vacant. The state of the cells changes every day according to the following rules: If a cell has two adjacent neighbors that are either both occupied or both vacant, the cell becomes occupied; otherwise, it becomes vacant. The first and last cells don’t have two neighbors, so they are excluded from the rule. You need to determine the state of the cells after ’n’ days of changes.

Leetcode 959: Regions Cut By Slashes

You are given an n x n grid where each cell contains one of the following characters: ‘/’, ‘', or ’ ‘. These characters divide the grid into different regions. Your task is to determine how many distinct regions the grid is divided into.

Leetcode 962: Maximum Width Ramp

You are given an integer array nums. A ramp in the array is a pair of indices (i, j) where i < j and nums[i] <= nums[j]. The width of the ramp is calculated as the difference between j and i (i.e., j - i). Your task is to find the maximum width of a ramp in the given array. If no such ramp exists, return 0.

Leetcode 963: Minimum Area Rectangle II

You are given a set of points in a 2D plane, represented as an array where each point is in the format [xi, yi]. Your task is to find the minimum possible area of any rectangle formed by these points, where the sides of the rectangle do not need to be parallel to the X or Y axes. If no rectangle can be formed, return 0. Answers within 10^-5 of the actual area are considered correct.