All Posts

Leetcode 1800: Maximum Ascending Subarray Sum

Given an array of positive integers ’nums’, return the maximum possible sum of an ascending subarray. A subarray is ascending if for each i, num[i] < num[i+1].

Leetcode 1801: Number of Orders in the Backlog

You are managing an order system for a marketplace where both buy and sell orders are placed in batches. Each order contains a price, a quantity, and a type (either buy or sell). You need to calculate how many orders remain unfulfilled in the system after processing all the orders.

Leetcode 1806: Minimum Number of Operations to Reinitialize a Permutation

You are given an even integer n and a permutation perm of size n where initially perm[i] = i (0-indexed). In each operation, you create a new array arr based on certain rules and update perm to arr. The goal is to determine the minimum number of operations required to restore perm to its initial state.

Leetcode 1807: Evaluate the Bracket Pairs of a String

You are given a string s containing several bracket pairs with non-empty keys. You are also provided a 2D array knowledge where each element is a key-value pair. Your task is to evaluate the string by replacing the keys inside the bracket pairs with their corresponding values. If a key is unknown, replace it with a question mark ?.

Leetcode 1813: Sentence Similarity III

You are given two sentences, sentence1 and sentence2, which consist of words separated by spaces. Two sentences are considered similar if you can insert any number of words (including none) into one of the sentences to make them identical. The inserted words must be separated by spaces.

Leetcode 1814: Count Nice Pairs in an Array

You are given an array of non-negative integers. A pair of indices (i, j) is nice if nums[i] + rev(nums[j]) equals nums[j] + rev(nums[i]). Return the number of nice pairs modulo 10^9 + 7.