HackerRank : Week of Code 24 – Happy Ladybugs

Happy Ladybugs is a board game having the following properties: The board is represented by a string, , of length . The character of the string, , denotes the cell of the board. If is an underscore (i.e., _), it means the cell of the board is empty. If is an uppercase English alphabetic letter (i.e., A through… Read More »

HackerRank : Week of Code 24 – Apple and Orange

Sam’s house has an apple tree and an orange tree that yield an abundance of fruit. In the diagram below, the red region denotes his house, where is the start point and is the end point. The apple tree is to the left of his house, and the orange tree is to its right. You can assume the… Read More »

CodeChef : October Challenge 2016 – Chef and Keyboard

Chef is a well known programmer. He owns a brand new Android phone of screen size of dimension n × m. Chef wants to design a program for painting the screen. He figured out c colors, which he will use to paint the screen. He wants to paint some rectangular section of pixels of the screen each with… Read More »

HackerRank : Moody’s Analytics University Hackathon – Asterisk Expressions

In Mathematics, exponentiation has higher operator precedence than multiplication. This means that any exponentiation in the expression must be evaluated first before before any multiplication. For the purposes of this challenge, exponentiation is left-associative, which is different than you would normally evaluate it. This means that is evaluated as and not as . In Python, the exponentiation operator… Read More »

HackerRank : Moody’s Analytics University Hackathon – Small Risk Trading

A company can make at most of available trades. Each available trade has the following properties: : A floating-point number denoting the trade’s probability of being profitable. : A floating-point number denoting the trade’s potential profit. : A floating-point number denoting the trade’s potential loss, which has a probability of . Given the values of , , and… Read More »