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.