You are given an integer array nums and an integer k. We define the K-or operation as follows: for each bit position, the bit in the result will be set to 1 if at least k numbers in the array nums have a 1 in that position. Return the K-or of the array nums.
In a tournament, there are ’n’ teams, each represented by an index from 0 to n-1. You are given a 2D boolean matrix grid of size n x n, where the value at grid[i][j] is 1 if team ‘i’ is stronger than team ‘j’, and 0 otherwise. Your task is to determine the champion team, which is the team that no other team is stronger than.
You are given two positive integers, ’n’ (number of candies) and ’limit’ (maximum number of candies each child can receive). Your task is to calculate how many different ways you can distribute ’n’ candies among 3 children such that no child receives more than ’limit’ candies.
You are given a 0-indexed array ’nums’. A pair of integers ‘x’ and ‘y’ is called a strong pair if it satisfies the condition |x - y| <= min(x, y). Your task is to find two integers from ’nums’ that form a strong pair and have the highest possible bitwise XOR value among all strong pairs in the array. You can pick the same integer twice.
You are given three strings: s1, s2, and s3. In each operation, you can choose one of these strings and remove its rightmost character. The goal is to determine the minimum number of operations required to make all three strings identical. If it’s impossible to make them equal, return -1.
You have n balls placed on a table, each either black or white, represented by a binary string s. In each move, you can swap two adjacent balls. Your task is to determine the minimum number of swaps required to move all black balls to the right side and all white balls to the left side.