All Posts

Leetcode 1775: Equal Sum Arrays With Minimum Number of Operations

You are given two arrays, nums1 and nums2, with integers between 1 and 6. The lengths of the two arrays can differ. In one operation, you can change any element in either array to any value between 1 and 6. The task is to find the minimum number of operations required to make the sums of the two arrays equal. If it is not possible to make the sums equal, return -1.

Leetcode 1785: Minimum Elements to Add to Form a Given Sum

You are given an integer array nums and two integers limit and goal. The elements of the array nums have a property such that abs(nums[i]) <= limit. Your task is to determine the minimum number of elements you need to add to the array in order to make the sum equal to goal. The added elements must also satisfy the condition that their absolute value is less than or equal to limit.

Leetcode 1792: Maximum Average Pass Ratio

A school has several classes, and each class will have students taking a final exam. You are provided with a 2D array where each class is represented by two values: the number of students who will pass and the total number of students in the class. Additionally, a number of brilliant students, ’extraStudents,’ is provided. These brilliant students are guaranteed to pass if assigned to any class. The goal is to assign these extra students to maximize the average pass ratio of all classes. The pass ratio of a class is defined as the number of students passing divided by the total number of students in the class. You need to return the maximum possible average pass ratio after optimally distributing the extra students.

Leetcode 1798: Maximum Number of Consecutive Values You Can Make

You are given an integer array ‘coins’, where each element represents the value of a coin you own. You can use these coins to create sums of values starting from 0. Your task is to find the maximum number of consecutive integer values starting from 0 that you can make with your coins.

Leetcode 1802: Maximum Value at a Given Index in a Bounded Array

You are tasked with constructing an array nums of length n such that: all elements are positive integers, the difference between adjacent elements is at most 1, the sum of elements does not exceed maxSum, and the value at index index is maximized. Return the value at index in the array nums.

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.