All Posts

Leetcode 2520: Count the Digits That Divide a Number

Given a positive integer num, determine how many of its digits divide num without leaving a remainder. In other words, for each digit in num, check if num % digit == 0 and count how many digits satisfy this condition.

Leetcode 2521: Distinct Prime Factors of Product of Array

Given an array of positive integers nums, find the number of distinct prime factors in the product of all the elements in the array. A prime factor of a number is a number that divides it evenly, and only divisible by 1 and itself. The goal is to calculate the distinct prime factors present in the prime factorization of the product of all elements in nums.

Leetcode 2523: Closest Prime Numbers in Range

Given two integers left and right, find the two prime numbers num1 and num2 such that: left <= num1 < num2 <= right, both are prime numbers, and the difference num2 - num1 is the smallest among all valid pairs. If multiple pairs have the same smallest difference, return the pair with the smallest num1. If no such pair exists, return [-1, -1].

Leetcode 2525: Categorize Box According to Criteria

Given the dimensions and mass of a box, categorize it based on the following conditions: If any dimension is >= 10,000 or the volume is >= 1,000,000,000, the box is ‘Bulky’. If the mass is >= 100, the box is ‘Heavy’. The box can be categorized as ‘Both’, ‘Heavy’, ‘Bulky’, ‘Neither’, or a combination of the categories.

Leetcode 2527: Find Xor-Beauty of Array

You are given an integer array nums. The xor-beauty of the array is the XOR of the effective values of all possible triplets of indices (i, j, k) where 0 <= i, j, k < n. The effective value for each triplet is calculated as ((nums[i] | nums[j]) & nums[k]).

Leetcode 2535: Difference Between Element Sum and Digit Sum of an Array

Given a positive integer array nums, compute the absolute difference between the element sum and the digit sum of the elements in the array.