All Posts
Leetcode 2540: Minimum Common Value
nums1
and nums2
sorted in non-decreasing order, return the smallest integer that is common to both arrays. If no such integer exists, return -1
.
Given two integer arrays Leetcode 2544: Alternating Digit Sum
You are given a positive integer n. Each digit of n has a sign according to the following rules: The most significant digit is assigned a positive sign. Each other digit has an opposite sign to its adjacent digits. Return the sum of all digits with their corresponding sign.
Leetcode 2549: Count Distinct Numbers on Board
n
, initially placed on a board. For each number x
on the board, find all integers i
such that 1 <= i <= n
and x % i == 1
. Add these numbers to the board. Your goal is to determine how many distinct integers will be present on the board after a billion days.
You are given a positive integer Leetcode 2553: Separate the Digits in an Array
nums
consisting of positive integers. Your task is to return a new array where each integer from nums
is separated into its individual digits, while maintaining the order of the integers.
You are given an array Leetcode 2558: Take Gifts From the Richest Pile
gifts
where each element represents the number of gifts in different piles. Every second, you pick the pile with the most gifts and leave behind the floor of the square root of the number of gifts. Repeat this operation for k
seconds, and return the total number of gifts left in all piles.
You are given an integer array Leetcode 2562: Find the Array Concatenation Value
You are given an array of integers, nums
, and you need to calculate the total concatenation value. To calculate this, you repeatedly perform the following operations until the array is empty:
- If the array has more than one element, take the first and last elements, concatenate them, and add the result to the total concatenation value. Then remove the first and last elements from the array.
- If the array has only one element, add it to the total concatenation value and remove the element.
The goal is to return the total concatenation value after performing all the operations.