All Posts

Leetcode 1545: Find Kth Bit in Nth Binary String

Given two positive integers n and k, the binary string Sn is formed recursively. The task is to return the kth bit in the string Sn.

Leetcode 1546: Maximum Number of Non-Overlapping Subarrays With Sum Equals Target

Given an integer array nums and an integer target, return the maximum number of non-empty, non-overlapping subarrays that sum up to the target.

Leetcode 1551: Minimum Operations to Make Array Equal

Given an integer n, create an array arr of length n where arr[i] = (2 * i) + 1. You can perform operations to make all elements in the array equal, with the goal of minimizing the number of operations.

Leetcode 1552: Magnetic Force Between Two Balls

You are given n baskets with distinct positions, and m balls to place in them. The magnetic force between two balls at positions x and y is |x - y|. The goal is to place the balls into baskets such that the minimum magnetic force between any two balls is maximized.

Leetcode 1557: Minimum Number of Vertices to Reach All Nodes

In a directed acyclic graph with n vertices, find the smallest set of vertices from which all nodes in the graph are reachable.

Leetcode 1559: Detect Cycles in 2D Grid

Given a 2D grid of characters, find if there exists a cycle where the same character repeats in the grid. A cycle is defined as a path where a character appears 4 or more times, forming a loop that starts and ends at the same cell. The cycle must consist of adjacent cells, and you are not allowed to revisit the previous cell.