All Posts

Leetcode 1995: Count Special Quadruplets

Given a 0-indexed integer array ’nums’, return the number of distinct quadruplets (a, b, c, d) such that:

  • nums[a] + nums[b] + nums[c] == nums[d], and
  • a < b < c < d.

Leetcode 2018: Check if Word Can Be Placed In Crossword

You are given an m x n matrix representing a crossword puzzle. The matrix contains lowercase English letters, empty spaces (’ ‘), and blocked cells (’#’). Given a word, determine if it can be placed horizontally or vertically in the crossword while adhering to the following constraints.

Leetcode 2044: Count Number of Maximum Bitwise-OR Subsets

Given an integer array nums, find the maximum bitwise OR that can be achieved by any subset of nums and count how many different non-empty subsets yield this maximum value. A subset is defined as any combination of elements from the array, and subsets are considered different if their elements are selected from different indices.

Leetcode 2048: Next Greater Numerically Balanced Number

An integer x is numerically balanced if, for every digit d in x, the digit d occurs exactly d times in the number. For example, 22 is numerically balanced because the digit 2 appears exactly 2 times, while 3133 is numerically balanced because the digit 3 appears exactly 3 times, and the digit 1 appears exactly 1 time.

Given an integer n, find the smallest numerically balanced integer that is strictly greater than n.

Leetcode 2171: Removing Minimum Number of Magic Beans

You are given an array of positive integers representing the number of magic beans in each bag. Your task is to remove some beans (possibly none) from each bag so that the number of beans in each remaining non-empty bag is equal. You need to find the minimum number of beans to remove.

Leetcode 2212: Maximum Points in an Archery Competition

Alice and Bob are opponents in an archery competition. Alice first shoots numArrows arrows, followed by Bob, in the target scoring sections from 0 to 11. The goal is to maximize Bob’s total score, ensuring that the sum of arrows shot by Bob equals numArrows.