All Posts

Leetcode 1818: Minimum Absolute Sum Difference

You are given two positive integer arrays nums1 and nums2 of the same length n. You are allowed to change at most one element of nums1 to any other value from nums1 to minimize the total absolute sum difference between nums1 and nums2. Return the minimum absolute sum difference after making the replacement. Since the answer may be large, return it modulo 10^9 + 7.

Leetcode 1823: Find the Winner of the Circular Game

In this problem, there are n friends sitting in a circle. The game proceeds by counting k friends clockwise starting from the 1st friend. The last friend counted leaves the circle. This continues until only one friend remains, who is the winner. Your task is to find the winner of the game given n and k.

Leetcode 1824: Minimum Sideway Jumps

A frog is traveling on a 3-lane road, starting at point 0 on lane 2. The frog wants to reach point n, but there may be obstacles at various points on the road. The frog can either move forward on the same lane or jump to another lane if the current lane is blocked. The goal is to find the minimum number of side jumps the frog needs to take to reach point n while avoiding obstacles.

Leetcode 1828: Queries on Number of Points Inside a Circle

You are given an array of points, each represented by its coordinates [xi, yi] on a 2D plane. You are also given an array of queries, where each query describes a circle defined by its center at (xj, yj) and its radius rj. For each query, your task is to compute how many points lie inside or on the border of the circle.

Leetcode 1829: Maximum XOR for Each Query

You are given a sorted array nums of non-negative integers and an integer maximumBit. For each query, you need to find the optimal integer k (less than 2^maximumBit) such that the XOR of all elements in the current nums array and k is maximized. Remove the last element from nums after each query and return an array of results.

Leetcode 1833: Maximum Ice Cream Bars

A boy wants to buy as many ice cream bars as possible, given their prices and the number of coins he has. Determine the maximum number of ice cream bars he can purchase without exceeding his budget.