All Posts

Leetcode 792: Number of Matching Subsequences

You are given a string s and an array of strings words. Your task is to determine how many words from the array are subsequences of the string s. A subsequence of a string is derived by deleting some or no characters from the original string without altering the order of the remaining characters.

Leetcode 794: Valid Tic-Tac-Toe State

Given a Tic-Tac-Toe board represented as a 3x3 string array, return true if and only if this board could have been reached during a valid Tic-Tac-Toe game. In a valid game, players alternate placing ‘X’ and ‘O’ characters into empty spaces. ‘X’ always goes first, and no player can move after the game has ended.

Leetcode 795: Number of Subarrays with Bounded Maximum

Given an integer array nums and two integers left and right, return the number of contiguous non-empty subarrays such that the maximum value in each subarray lies within the inclusive range [left, right].

Leetcode 797: All Paths From Source to Target

You are given a directed acyclic graph (DAG) with n nodes, labeled from 0 to n-1. Find all possible paths from node 0 to node n-1 and return these paths in any order. The graph is represented such that each node has a list of other nodes that can be visited directly from it.

Leetcode 799: Champagne Tower

You are given a champagne tower in the shape of a pyramid. The topmost glass is filled with a specified amount of champagne. When a glass is full, the excess champagne spills equally into the two glasses directly beneath it. Given the total amount of champagne poured, determine how full a particular glass at row query_row and glass query_glass will be after the champagne has spilled.

Leetcode 802: Find Eventual Safe States

You are given a directed graph where each node represents a point, and edges represent possible transitions between nodes. A node is considered terminal if it has no outgoing edges. A node is deemed safe if every path starting from it leads either to a terminal node or another safe node. Your task is to identify all the safe nodes in the graph and return them in ascending order.