• Egg Dropping Puzzle[DP][GFG]

    Egg Dropping Puzzle[DP][GFG]

    Egg Dropping Puzzle[DP][GFG] Problem: The following is a description of the instance of this famous puzzle involving n=2 eggs and a building with k=36 floors. Suppose that we wish to know which stories in a 36-story building are safe to drop eggs from, and which will cause the eggs to break on landing. We make Read more

  • Sparse Arrays[HackerRank Solution]

    Sparse Arrays[HackerRank Solution]

    Sparse Arrays[HackerRank Solution] Problem: There is a collection of N strings ( There can be multiple occurences of a particular string ). Each string’s length is no more than 20 characters. There are also Q queries. For each query, you are given a string, and you need to find out how many times this string occurs in the Read more

  • Sherlock and Array[HackerRank Solution]

    Sherlock and Array[HackerRank Solution]

    Sherlock and Array[HackerRank Solution] Problem: Watson gives Sherlock an array A of length n. Then he asks him to determine if there exists an element in the array such that the sum of the elements on its left is equal to the sum of the elements on its right. If there are no elements to the Read more

  • Chocolate Feast[HackerRank Solution]

    Chocolate Feast[HackerRank Solution]

    Chocolate Feast[HackerRank Solution] Problem: Little Bobby loves chocolate, and he frequently goes to his favorite  store, Penny Auntie, with  dollars to buy chocolates. Each chocolate has a flat cost of  dollars, and the store has a promotion where they allow you to trade in  chocolate wrappers in exchange for  free piece of chocolate. For example, if  and Bobby has  dollars that he Read more

  • The Maximum Subarray[HackerRank Solution]

    The Maximum Subarray[HackerRank Solution]

    The Maximum Subarray[HackerRank Solution] Dynamic Programming Problem: Given an array of N elements, find the maximum possible sum among all nonempty subarrays. all nonempty subsequences. We define a subarray as a contiguous subsequence. Note that empty subarrays/subsequences should not be considered. Input Format The first line of input contains a single integer T denoting the number of test cases. The first Read more

  • Big Sorting[HackerRank Solution]

    Big Sorting[HackerRank Solution]

    Big Sorting[HackerRank Solution] Problem: Consider an array of numeric strings, , where each string is a positive number with anywhere from  to  digits. Sort the array’s elements in non-decreasing (i.e., ascending) order of their real-world integer values and print each element of the sorted array on a new line. Input Format The first line contains an integer, , denoting the number Read more

Advertisements