You are given n points on a 1-D plane, where each point i is at x = i. Your task is to find the number of ways to draw exactly k non-overlapping line segments that cover two or more points, such that the endpoints are integral. Return the result modulo 10^9 + 7.
You are given an inventory of different colored balls. The customer wants to buy a specific number of balls, and each ball has a value based on how many of that color are still available. Calculate the maximum total value you can obtain after fulfilling the customer’s order. The result should be returned modulo 10^9 + 7.
Given an integer n, form a binary string by concatenating the binary representations of all integers from 1 to n. Convert this concatenated binary string to its decimal equivalent and return the result modulo 10^9 + 7.
You are given a sorted integer array nums. Build and return an integer array result such that for each index i, result[i] is equal to the summation of absolute differences between nums[i] and all other elements in the array.
Alice and Bob take turns playing a game with a pile of n stones, each having a value assigned by both players. They play optimally and aim to maximize their total points by choosing stones with the highest value for each player.
In a tournament with n teams, each round involves pairing teams for matches. The number of matches depends on whether n is even or odd. Calculate the total number of matches played in the tournament until a winner is determined.