All Posts

Leetcode 698: Partition to K Equal Sum Subsets

Given an integer array nums and an integer k, your task is to determine if it is possible to divide this array into k non-empty subsets such that each subset has an equal sum.

Leetcode 756: Pyramid Transition Matrix

You are building a pyramid by stacking blocks, each represented by a color denoted by a letter. Each row above the bottom consists of one less block, centered on the row beneath. Only specific triangular patterns of blocks are allowed. A triangular pattern consists of three blocks: two at the bottom and one on top. Given the bottom row and allowed patterns, determine if it’s possible to construct the pyramid.

Leetcode 762: Prime Number of Set Bits in Binary Representation

Given two integers left and right, return the count of numbers in the inclusive range [left, right] having a prime number of set bits in their binary representation. The number of set bits in a number is the count of 1’s when the number is represented in binary. A prime number is a number greater than 1 that is divisible only by 1 and itself.

Leetcode 779: K-th Symbol in Grammar

We build a sequence of rows starting with the string ‘0’ in the first row. For each subsequent row, every occurrence of ‘0’ from the previous row is replaced with ‘01’, and every occurrence of ‘1’ is replaced with ‘10’. Given two integers n and k, return the k-th (1-indexed) symbol in the n-th row.

Leetcode 784: Letter Case Permutation

Given a string s, you can transform every letter individually to either lowercase or uppercase. Digits remain unchanged. Your task is to generate a list of all possible strings that can be created by changing the case of the letters in the string.

Leetcode 861: Score After Flipping Matrix

You are given a binary matrix where each row and column can be toggled independently. A toggle operation flips all values in a row or column (changing 0s to 1s and 1s to 0s). The matrix’s score is calculated by interpreting each row as a binary number and summing up these values. Your task is to determine the maximum score possible after performing any number of toggle operations.