All Posts

Leetcode 2226: Maximum Candies Allocated to K Children

You are given a 0-indexed integer array candies, where each element represents the number of candies in a pile. You also have an integer k, which is the number of children. You need to distribute the candies into k piles such that each child gets the same number of candies. Each child can receive at most one pile, and some piles may go unused. Your task is to return the maximum number of candies each child can receive.

Leetcode 2233: Maximum Product After K Increments

You are given an array of non-negative integers and an integer k. In one operation, you can choose any element from the array and increment it by 1. Your task is to determine the maximum product of the array elements after at most k operations. The result should be returned modulo 10^9 + 7.

Leetcode 2239: Find Closest Number to Zero

Given an array of integers, find the number closest to 0. If there are multiple numbers equally close, return the largest number among them.

Leetcode 2241: Design an ATM Machine

Design an ATM machine that can handle deposits and withdrawals of five denominations: $20, $50, $100, $200, and $500. When withdrawing, the machine always tries to use the highest denominations available first. Implement methods to deposit money and withdraw specified amounts.

Leetcode 2245: Maximum Trailing Zeros in a Cornered Path

You are given a 2D integer array called grid of size m x n, where each cell contains a positive integer. A cornered path is a specific path in the grid with at most one directional change. The path must move either horizontally or vertically up to a single turn and then continue in the alternate direction. The product of a path is the product of all integers in that path. The task is to find the maximum number of trailing zeros in the product of a cornered path.

Leetcode 2249: Count Lattice Points Inside a Circle

You are given a 2D integer array circles, where each element circles[i] = [xi, yi, ri] represents a circle with center at (xi, yi) and radius ri. The task is to find the number of lattice points that lie inside at least one of the given circles. A lattice point is defined as a point with integer coordinates, and points lying on the circumference of a circle are also considered inside.