All Posts

Leetcode 2348: Number of Zero-Filled Subarrays

You are given an integer array nums. Your task is to determine the total number of subarrays that consist entirely of zeroes.

Leetcode 2349: Design a Number Container System

Design a number container system that allows inserting or replacing a number at a specific index and finding the smallest index for a given number.

Leetcode 2352: Equal Row and Column Pairs

Given a square matrix of integers, find the number of pairs of row and column indices where the row and column are equal in terms of their elements and their order.

Leetcode 2353: Design a Food Rating System

Design a food rating system that allows modification of food ratings and can return the highest-rated food item for a given cuisine. In case of a tie, the lexicographically smallest food item should be returned.

Leetcode 2358: Maximum Number of Groups Entering a Competition

You are given a positive integer array grades which represents the grades of students. Your goal is to group these students into ordered non-empty groups where:

  1. The sum of the grades in the i-th group is less than the sum of the grades in the (i + 1)-th group.
  2. The number of students in the i-th group is less than the number of students in the (i + 1)-th group. Return the maximum number of groups that can be formed.

Leetcode 2359: Find Closest Node to Given Two Nodes

You are given a directed graph with n nodes, where each node can have at most one outgoing edge. You are provided with an array edges representing the graph, where edges[i] indicates a directed edge from node i to node edges[i] (or -1 if there is no outgoing edge). You are also given two nodes node1 and node2. The task is to return the node that is reachable from both node1 and node2, such that the maximum of the distances from node1 and node2 to that node is minimized. If there are multiple such nodes, return the smallest index, or return -1 if no such node exists.