All Posts

Leetcode 2800: Shortest String That Contains Three Strings

Given three strings ‘a’, ‘b’, and ‘c’, find a string that contains all three of these strings as substrings and has the minimum possible length. If there are multiple such strings, return the lexicographically smallest one.

Leetcode 2843: Count Symmetric Integers

You are given two integers low and high. Return the number of symmetric integers in the range [low, high]. A symmetric integer has an even number of digits, and the sum of the first half of its digits equals the sum of the second half. Numbers with an odd number of digits are never symmetric.

Leetcode 2844: Minimum Operations to Make a Special Number

You are given a non-negative integer represented as a string num. In one operation, you can remove any single digit from the string. If you remove all digits, the result becomes 0. Your task is to return the minimum number of operations required to make the number divisible by 25. A number is divisible by 25 if it ends in 00, 25, 50, or 75.

Leetcode 2860: Happy Students

You are given a list of integers where each integer represents a student’s happiness threshold. The task is to determine the number of ways to select a group of students so that all students in the group remain happy.

Leetcode 2928: Distribute Candies Among Children I

You are given two positive integers, ’n’ (number of candies) and ’limit’ (maximum number of candies each child can receive). Your task is to calculate how many different ways you can distribute ’n’ candies among 3 children such that no child receives more than ’limit’ candies.

Leetcode 2934: Minimum Operations to Maximize Last Elements in Arrays

You are given two integer arrays, nums1 and nums2, both having length n. You are allowed to perform a series of operations (possibly none). In each operation, you can select an index i in the range [0, n-1] and swap the values of nums1[i] and nums2[i]. The goal is to satisfy two conditions: the last element of nums1 is equal to the maximum value in nums1, and the last element of nums2 is equal to the maximum value in nums2. Return the minimum number of operations required, or -1 if it’s impossible to satisfy both conditions.