All Posts

Leetcode 1572: Matrix Diagonal Sum

You are given a square matrix of integers. Your task is to calculate the sum of all the elements located on the primary diagonal and the secondary diagonal, excluding the element that appears on both diagonals (i.e., the center element in an odd-sized matrix).

Leetcode 1582: Special Positions in a Binary Matrix

You are given a binary matrix of size m x n, where each element is either 0 or 1. A position (i, j) in the matrix is considered special if mat[i][j] = 1 and all other elements in the same row i and column j are 0. Your task is to find how many such special positions exist in the matrix.

Leetcode 1598: Crawler Log Folder

You are working with a file system that logs folder change operations. The file system starts in the main folder, and the operations allow the user to move to a parent folder, remain in the current folder, or navigate to a child folder. Given a list of operations, your task is to determine the minimum number of operations required to return to the main folder after performing all the operations.

Leetcode 1603: Design Parking System

You are tasked with designing a parking system for a parking lot that has three types of parking spaces: large, medium, and small. Each type of parking space has a fixed number of available slots. Your goal is to implement the ParkingSystem class that supports the operations of initializing the parking system and parking a car based on its type.

Leetcode 1624: Largest Substring Between Two Equal Characters

Given a string s, find the length of the longest substring between two equal characters, excluding the two characters themselves. If no such substring exists, return -1.

Leetcode 1637: Widest Vertical Area Between Two Points Containing No Points

Given n points on a 2D plane, where points[i] = [xi, yi], return the widest vertical area between two points such that no points are inside the area. A vertical area is defined as a fixed-width region that extends infinitely along the y-axis. The widest vertical area is the one with the maximum width. Note that points on the edge of the vertical area are not considered inside.