Question Last night you partied a little too hard. Now there's a black and white photo of you that's about to go viral! You can't let this ruin your reputation, so you want to apply the box blur algorithm to the photo to hide its content. The pixels in the input image are represented as integers. The algorithm distorts the input image in the following way: Every pixel x in the output..
Question You are given an array of integers representing coordinates of obstacles situated on a straight line. Assume that you are jumping from the point with coordinate 0 to the right. You are allowed only to make jumps of the same length represented by some integer. Find the minimal length of the jump enough to avoid all the obstacles. Example For inputArray = [5, 3, 6, 7, 9], the output shoul..
Question An IP address is a numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet Protocol for communication. There are two versions of the Internet protocol, and thus two versions of addresses. One of them is the IPv4 address. Given a string, find out if it satisfies the IPv4 address naming rules Example For inputString = "1..
Question Given an array of integers, find the maximal absolute difference between any two of its adjacent elements. Example For inputArray = [2, 4, 1, 0], the output should be arrayMaximalAdjacentDifference(inputArray) = 3. Input/Output [execution time limit] 4 seconds (py3) [input] array.integer inputArray Guaranteed constraints: 3 ≤ inputArray.length ≤ 10, -15 ≤ inputArray[i] ≤ 15. [output] in..
Question Call two arms equally strong if the heaviest weights they each are able to lift are equal. Call two people equally strong if their strongest arms are equally strong (the strongest arm can be both the right and the left), and so are their weakest arms. Given your and your friend's arms' lifting capabilities find out if you two are equally strong. Example For yourLeft = 10, yourRi..
Question Given a string, find out if its characters can be rearranged to form a palindrome. Example For inputString = "aabb", the output should be palindromeRearranging(inputString) = true. We can rearrange "aabb" to make "abba", which is a palindrome. Input/Output [execution time limit] 4 seconds (py3) [input] string inputString A string consisting of lowercase English letters. Guaranteed const..
Question You are given an array of integers. On each move you are allowed to increase exactly one of its element by one. Find the minimal number of moves required to obtain a strictly increasing sequence from the input. Example For inputArray = [1, 1, 1], the output should be arrayChange(inputArray) = 3. For inputArray = [2, 1, 10, 1], the output should be arrayChange(inputArray) = 12. Input/Out..
Question Two arrays are called similar if one can be obtained from another by swapping at most one pair of elements in one of the arrays. Given two arrays a and b, check whether they are similar. Example For a = [1, 2, 3] and b = [1, 2, 3], the output should be areSimilar(a, b) = true. The arrays are equal, no need to swap any elements. For a = [1, 2, 3] and b = [2, 1, 3], the output should be a..