# Archive for March 2019

Problem Statement Given arrays of different sizes, find the number of distinct triplets where is an element of , written as , , and , satisfying the criteria: and For example, given and we find four distinct triplets: $latex(3,6,4), (3,6,6), (5,6,4), (5,6,6)$ Function Description Complete the triplets function in the . . . Read more

Problem Statement In this challenge, you will be given an array of integers, each unique within the array, and an integer representing a target difference. Determine the number of pairs of elements in the array that have a difference equal to the target difference. For example, consider the array [1, . . . Read more

Problem Statement Each time Sunny and Johnny take a trip to the Ice Cream Parlor, they pool their money to buy ice cream. On any given day, the parlor offers a line of flavors. Each flavor has a cost associated with it. Given the value of and the of each . . . Read more

Problem Statement Alex wants to paint a picture but hates taking the brush off the canvas. In one stroke, Alex can only paint the same colored cells which are joined via some edge. Given the painting, determine the minimum number of strokes to completely paint the picture. Take for example, . . . Read more

Problem Statement Consider a string, S, that is a series of characters, each followed by its frequency as an integer. The string is not compressed correctly, so there may be many occurrences of the same character. A properly compressed string will consist of one instance of each character in alphabetical . . . Read more

Problem Statement A child likes to build mud walls by placing mud between sticks positioned on a number line. The gap between sticks will be referred to as a cell, and each cell will contain one segment of wall. The height of mud in a segment cannot exceed 1 unit . . . Read more

Problem Statement This semester you are taking a course taught by a faculty member who has a weird way of grading tests. In a test, n questions will be asked, and the correctness of the answers is already determined. For the ith question, the verdict will be v[i] (where 0 . . . Read more

Problem Statement A subarray of array a is defined as a contiguous block of a’s elements having a length that is less than or equal to the length of the array. For example, the subarrays of array a = [1, 2, 3] are [1], [2], [3], [1, 2], [2, 3], . . . Read more

Problem Statement You are given an array of integers and must compute the maximum difference between any item and any lower indexed smaller item for all the possible pairs, i.e., for a given array ‘a’, find the maximum value of a[j] – a[i] for all i, j where 0 ≤ . . . Read more

Problem Statement Two strings are anagrams if they are permutations of each other. For example, “aaagmnrs” is an anagram of “anagrams”. Given an array of strings, remove each string that is an anagram of an earlier string, then return the remaining array in sorted order. For example, given the strings . . . Read more