All Posts

Leetcode 1472: Design Browser History

You are tasked with simulating the history of web page visits in a browser. Implement the BrowserHistory class to manage visit, back, and forward actions.

Leetcode 1504: Count Submatrices With All Ones

You are given a binary matrix of size m x n where each element is either 0 or 1. Your task is to count how many submatrices consist entirely of 1s.

Leetcode 1541: Minimum Insertions to Balance a Parentheses String

You are given a string s containing only the characters '(' and ')'. A string is considered balanced if each '(' has a matching pair of consecutive '))' and if they appear in the correct order. Your task is to return the minimum number of insertions needed to make the string balanced.

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 1653: Minimum Deletions to Make String Balanced

You are given a string s consisting of the characters ‘a’ and ‘b’. The goal is to delete the minimum number of characters from s to make it balanced. A string is balanced if no ‘b’ precedes an ‘a’.

Leetcode 1673: Find the Most Competitive Subsequence

Given an integer array nums and a positive integer k, return the most competitive subsequence of nums of size k. A subsequence is more competitive than another if at the first position where they differ, the subsequence has a smaller number.