All Posts

Leetcode 2566: Maximum Difference by Remapping a Digit

You are given an integer num, and you know that Bob will sneakily remap one of the 10 possible digits (0 to 9) to another digit. Your task is to return the difference between the maximum and minimum values Bob can make by remapping exactly one digit in num. If no change is made, the value of num remains the same.

Leetcode 2570: Merge Two 2D Arrays by Summing Values

You are given two 2D integer arrays nums1 and nums2. Each element in nums1 and nums2 is an array of two integers: an id and a value. The arrays are sorted in ascending order by the id. Your task is to merge the two arrays into a single array, sorted by id. Each id should appear only once, and if an id appears in both arrays, its value should be the sum of the values from both arrays. If an id is present in only one array, its value remains as it is.

Leetcode 2574: Left and Right Sum Differences

You are given a 0-indexed integer array nums. Find a 0-indexed integer array answer where: answer[i] = |leftSum[i] - rightSum[i]|, where leftSum[i] is the sum of elements to the left of the index i, and rightSum[i] is the sum of elements to the right of the index i.

Leetcode 2578: Split With Minimum Sum

Given a positive integer num, split it into two non-negative integers num1 and num2 such that the concatenation of num1 and num2 is a permutation of the digits of num. The goal is to minimize the sum of num1 and num2.

Leetcode 2582: Pass the Pillow

You are given the root of a binary tree and a positive integer k. The level sum in the tree is the sum of the node values that lie at the same level. Return the kth largest level sum in the tree. If there are fewer than k levels, return -1. Nodes are on the same level if they are at the same distance from the root.

Leetcode 2586: Count the Number of Vowel Strings in Range

You are given a 0-indexed integer array nums. You can rearrange the elements of nums to any order (including the given order). Define the prefix sum array of nums as prefix[i] = sum(nums[0] to nums[i]) after rearranging. The score of nums is the number of positive integers in the prefix array. Return the maximum score you can achieve by rearranging the elements of nums.