Short version: two algorithm questions, one data-structure question, one development-related question, and one statistics question.
For an array of n positive integers arr[n] and an integer k, a subarray is good if it contains at least k distinct integers. Find the minimum length of a good subarray; otherwise return -1.
Given a list containing an odd number of positive integers, you may remove exactly one element and then pair the remaining elements arbitrarily. For each pairing, compute the sum of the absolute differences within each pair. For any chosen element to remove, the pairing is selected to minimize that sum. Which element should be removed to achieve the global minimum across all choices?
Linked list versus array.
Count how many files are in a directory using a Bash command.
You roll a fair six-sided die. If you roll a 1 or 2, you receive that amount in dollars ($1 or $2), and the game ends immediately. If you roll a 3, 4, 5, or 6, you receive that amount and may then choose whether to continue playing, rolling again and accumulating your winnings. How much would you be willing to pay to play this game?
Discussion
Loading comments…