Editorials for September Rush


With heavy participation in the September rush, and request for solutions to the problems

1. The editorials for the problems in our monthly contest for September - September Rush have been published.Counting Strings - Problem statement: You need to find the number of substrings of the input string that contain the letter an or z. Editorial : http://learn.hackerearth.com/tutorial/string-manipulation/79/editorial-for-counting-strings/

2. Game of Survival - Problem statement: You are given strengths of animals and sharpness of swords. You need to find if all the animals can be killed with the swords. An animal can be killed with a sword if and only if its strength is less than the sharpness of the sword and you can use a sword to kill at max one animal. Editorial:  http://learn.hackerearth.com/tutorial/programming/80/editorial-for-game-of-survival/

3.Painting the Road - Problem statement: A road of length L has to be painted. You have K proposals. Each proposal paints some part of the road for which coordinates are given and it has some cost. You need to paint the road with minimum cost. Editorial: http://learn.hackerearth.com/tutorial/dynamic-programming/81/editorial-for-painting-the-road/

4. Maximum Score - Problem statement: Alice and Bob are playing a game. They both agree up on a number M and the score is set to 0 initially. Alice chooses t > 0 consecutive integers starting from 1 i.e numbers 1, 2, ...t. Bob chooses t consecutive integers starting from any x > 0 i.e numbers x, x + 1, x +2, ... x + t - 1. Alice and Bob both multiply all the numbers they have chosen. If the ratio of results got by Alice and Bob is 1:M they will increase the score by 1 and continue playing the game, else they quit playing the game. No two games played must be identical. Two games are said to be identical if both Alice and Bob chooses same sequence of numbers in both the games. Find the maximum score they can get for a given M. Editorial: http://learn.hackerearth.com/tutorial/programming/82/editorial-for-maximum-score/

5. Number Game - Problem statement: You need to count the number of subsets in a given set such that, if the game is played on those set of numbers first player always wins. Each step in the game is replacing the number by its factor which is less than the number. Player who cannot make a step will lose. Editorial: http://learn.hackerearth.com/tutorial/game-theory/83/editorial-for-number-game/


The problems have been arranged in the increasing order of their difficulty.

Hope it helps you finding the correct approach to the solutions.

Happy Coding

About the Author

I am the co-founder and CEO of HackerEarth, I mostly do Business development for HackerEarth but I started my career as a programmer. I also have a passion for writing.