All Posts

Leetcode 2420: Find All Good Indices

Given an integer array nums of size n and a positive integer k, find all good indices in the array. An index i is considered good if: The k elements just before it are in non-increasing order, and the k elements just after it are in non-decreasing order. Return a list of all good indices in increasing order.

Leetcode 2425: Bitwise XOR of All Pairings

You are given two arrays, nums1 and nums2, each consisting of non-negative integers. You need to calculate the XOR of all possible pairings between the integers in nums1 and nums2. The result should be the XOR of all the numbers from this new array formed by XORing every integer in nums1 with every integer in nums2.

Leetcode 2428: Maximum Sum of an Hourglass

You are given a matrix of integers. An hourglass is defined as a pattern of elements in the matrix where the middle element is surrounded by 3 elements above it and 3 elements below it, forming the shape of an hourglass. Your task is to find the maximum sum of all hourglasses that can be formed within the matrix.

Leetcode 2432: The Employee That Worked on the Longest Task

You are given a group of employees, each identified by a unique ID. A series of tasks have been completed, where each task has a specific start and end time. Your task is to identify which employee worked the longest on a task. If there is a tie between multiple employees, return the one with the smallest ID. The time for each task is calculated by subtracting the start time from the end time, and each task starts right after the previous one ends.

Leetcode 2433: Find The Original Array of Prefix Xor

You are given an integer array pref of size n. Your task is to find and return an array arr of size n that satisfies the following condition: each element pref[i] equals the XOR of all elements from arr[0] to arr[i]. In other words, pref[i] = arr[0] ^ arr[1] ^ ... ^ arr[i] where ^ denotes the bitwise XOR operation. It is guaranteed that there is a unique solution.

Leetcode 2438: Range Product Queries of Powers

Given a positive integer n, you need to construct an array called powers that contains the minimum number of powers of 2 that sum up to n. The array powers should be sorted in non-decreasing order. You are also given a set of queries where each query asks for the product of the powers in the powers array between indices left and right (both inclusive). For each query, return the product modulo 10^9 + 7.