All Posts

Leetcode 2194: Cells in a Range on an Excel Sheet

You are given a range of cells in an Excel sheet, represented by two cell positions in the format ‘:’, where <col1> and <col2> represent the starting and ending column letters, and <row1> and <row2> represent the starting and ending row numbers. Your task is to return all the cells within the specified range, sorted first by column and then by row.

Leetcode 2210: Count Hills and Valleys in an Array

You are given an integer array ’nums’. A number at index ‘i’ is part of a hill if its closest non-equal neighbors on both sides are smaller than the number at index ‘i’. Similarly, an index ‘i’ is part of a valley if its closest non-equal neighbors on both sides are larger than the number at index ‘i’. Adjacent indices ‘i’ and ‘j’ are part of the same hill or valley if the values at nums[i] and nums[j] are the same. An index must have non-equal neighbors on both sides to be part of a hill or valley. Your task is to count the total number of hills and valleys.

Leetcode 2215: Find the Difference of Two Arrays

You are given two integer arrays, nums1 and nums2. Your task is to return a list of two arrays. The first array should contain all distinct integers that are in nums1 but not in nums2. The second array should contain all distinct integers that are in nums2 but not in nums1.

Leetcode 2220: Minimum Bit Flips to Convert Number

You are given two integers, start and goal. The task is to determine the minimum number of bit flips required to convert start into goal. A bit flip consists of choosing a bit in the binary representation of a number and flipping it from 0 to 1 or from 1 to 0.

Leetcode 2224: Minimum Number of Operations to Convert Time

You are given two 24-hour formatted times, current and correct. Each time is represented in the format ‘HH:MM’, where HH is the hour (00 to 23) and MM is the minutes (00 to 59). In one operation, you can increase the current time by 1, 5, 15, or 60 minutes. Your task is to determine the minimum number of operations required to convert the current time to the correct time.

Leetcode 2231: Largest Number After Digit Swaps by Parity

You are given a positive integer num. You are allowed to swap any two digits of num that have the same parity (i.e., both digits are either odd or both even). The goal is to return the largest possible value of num after any number of swaps.