Consider an array of integers, . We define the absolute difference between two elements, and (where ), to be the absolute value of .
Showing posts with label Greedy Algorithms. Show all posts
Showing posts with label Greedy Algorithms. Show all posts
Saturday, February 23, 2019
Reverse Shuffle Merge - Hacker Rank Solution
Given a string, , we define some operations on the string as follows:
a. denotes the string obtained by reversing string . Example:b. denotes any string that's a permutation of string . Example:
Max Min - Hacker Rank Solution
You will be given a list of integers, , and a single integer . You must create an array of length from elements of such that its unfairness is minimized. Call that array .
Greedy Florist - Hacker Rank Solution
A group of friends want to buy a bouquet of flowers. The florist wants to maximize his number of new customers and the money he makes. To do this, he decides he'll multiply the price of each flower by the number of that customer's previously purchased flowers plus .
Luck Balance - Hacker Rank Solution
Lena is preparing for an important coding competition that is preceded by a number of sequential preliminary contests. She believes in "saving luck", and wants to check her theory. Each contest is described by two integers, and :
Subscribe to:
Posts (Atom)