# CategoryHackerRank

H

Short Problem Definition: Anna and Brian are sharing a meal at a restaurant and they agree to split the bill equally. Brian wants to order something that Anna is allergic to though, and they agree that Anna wonât pay for that item. Brian gets the check and calculates Annaâs portion. You must determine if his calculation is correct. Link Bon AppĂ©tit Complexity: time complexity is O(N) space...

## HackerRank âBreaking The Recordsâ Solution

H

Short Problem Definition: Maria plays college basketball and wants to go pro. Each season she maintains a record of her play. She tabulates the number of times she breaks her season record for most points and least points in a game. Points scored in the first game establish her record for the season, and she begins counting from there. Link Breaking The Records Complexity:...

## HackerRank âCaesar Cipherâ Solution

H

Short Problem Definition: Julius Caesar protected his confidential information from his enemies by encrypting it. Caesar rotated every alphabet in the string by a fixed number K. This made the string unreadable by the enemy. You are given a string S and the number K. Encrypt the string and print the encrypted string. Link Caesar Cipher Complexity: time complexity is O(?) space complexity is O(?)...

## HackerRank âCamelCaseâ Solution

H

Short Problem Definition: Alice wrote a sequence of words in CamelCase as a string of letters, , having the following properties: It is a concatenation of one or more words consisting of English letters. All letters in the first word are lowercase. For each of the subsequent words, the first letter is uppercase and rest of the letters are lowercase...

## HackerRank âA Very Big Sumâ Solution

H

Short Problem Definition:
Calculate and print the sum of the elements in an array, keeping in mind that some of those integers may be quite large.
A Very Big Sum
Complexity:
time complexity is O(N)
space complexity is O(1)
Execution:
Just add all of this together. No magic.
Solution:

## HackerRank âCastle on the Gridâ Solution

H

Short Problem Definition: You are given a grid with both sides equal to N/N. Rows and columns are numbered from 0/0 to Nâ1/Nâ1. There is a castle on the intersection of the aath row and the bbth column. Your task is to calculate the minimum number of steps it would take to move the castle from its initial position to the goal position (c/d). It is guaranteed that it is possible to reach the goal...

## HackerRank âAbsolute Permutationâ Solution

H

Short Problem Definition: We define P to be a permutation of the first n natural numbers in the range [1,n]. Let pos[i] denote the value at position i in permutation P using 1-based indexing. P is considered to be an absolute permutation if |pos[i]-i| = K holds true for every i. Â Link Absolute Permutation Complexity: time complexity is O(N) space complexity is O(N) Execution: The time complexity...

## HackerRank âCats And A Mouseâ Solution

H

Short Problem Definition: Two cats and a mouse are at various positions on a line. You will be given their starting positions. Your task is to determine which cat will reach the mouse first, assuming the mouse doesnât move and the cats travel at equal speed. If the cats arrive at the same time, the mouse will be allowed to move and it will escape while they fight. Link Cats And A Mouse...