All Posts

Leetcode 2164: Sort Even and Odd Indices Independently

You are given a 0-indexed integer array ’nums’. Your task is to rearrange the elements of ’nums’ by sorting the values at odd indices in non-increasing order and the values at even indices in non-decreasing order. Return the rearranged array.

Leetcode 2169: Count Operations to Obtain Zero

You are given two non-negative integers, num1 and num2. In each operation, subtract the smaller number from the larger one. Continue until one of the numbers becomes zero and return the number of operations performed.

Leetcode 2176: Count Equal and Divisible Pairs in an Array

You are given a 0-indexed integer array nums of length n and an integer k. You need to count the number of pairs (i, j) where 0 <= i < j < n such that nums[i] == nums[j] and the product i * j is divisible by k. Return the number of such pairs.

Leetcode 2180: Count Integers With Even Digit Sum

Given a positive integer num, return the number of positive integers less than or equal to num whose digit sum is even.

Leetcode 2185: Counting Words With a Given Prefix

You are given an array of strings and a target prefix. Your task is to count how many strings in the array start with this target prefix.

Leetcode 2190: Most Frequent Number Following Key In an Array

You are given an integer array ’nums’ and an integer ‘key’, which is present in ’nums’. Your task is to find the integer that most frequently appears immediately after an occurrence of ‘key’ in the array. In other words, count how many times each integer follows ‘key’ and return the integer that appears the most.