omarsamy3 / HackerRank-Problems

It is a simple repo to practice problem-solving on the HackerRank website.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HackerRank-Problems

This repository contains a collection of problem-solving solutions for the HackerRank website. It serves as a practice ground for sharpening your coding skills and tackling various algorithmic challenges.

Easy Problems

  1. Simple Array Sum

  2. Compare the Triplets

  3. A Very Big Sum

    • Description: You are required to calculate and print the sum of the elements in an array, keeping in mind that some of those integers may be quite large.
    • Solution: AVeryBigSum.cs
    • Unit Tests: AVeryBigSumTests.cs
  4. Diagonal Difference

  5. Plus Minus

    • Description: Given an array of integers, calculate the ratios of its elements that are positive, negative, and zero. Print the decimal value of each fraction on a new line with 6 places after the decimal.
    • Solution: PlusMinus.cs
    • Unit Tests: PlusMinusTests.cs
  6. Staircase

    • Description: The Staircase problem involves printing a pattern of '#' symbols representing a staircase of a given height 'n'. Each line contains a specific number of '#' symbols, forming a staircase shape.
    • Solution: Staircase.cs
    • Unit Tests: StaircaseTests.cs
  7. Mini-Max Sum

    • Description: Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.
    • Solution: MiniMaxSum.cs
    • Unit Tests: MiniMaxSumTests.cs
  8. Time Conversion

  9. Day of the Programmer

    • Description: Given a year, y, find the date of the 256th day of that year according to the official Russian calendar during that year. Then print it in the format dd.mm.yyyy, where dd is the two-digit day, mm is the two-digit month, and yyyy is y.
    • Solution: DayOfTheProgrammer.cs
    • Unit Tests: DayOfTheProgrammerTests.cs
  10. Bill Division

  • Description: It should print Bon Appetit if the bill is fairly split. Otherwise, it should print the integer amount of money that Brian owes Anna.
  • Solution: BillDivision.cs
  • Unit Tests: BillDivisionTests.cs
  1. Maximum Element
  • Description: You have an empty sequence, and you will be given queries. Each query is one of these three types:
    1 x -Push the element x into the stack.
    2 -Delete the element present at the top of the stack.
    3 -Print the maximum element in the stack.
  • Solution: MaximumElement.cs
  • Unit Tests: MaximumElementTests.cs
  1. Equal Stacks
  • Description: Find the maximum possible height of the stacks such that all of the stacks are exactly the same height.
  • Solution: EqualStacks.cs
  • Unit Tests: EqualStacksTests.cs
  1. Grading Students
  1. Picking Numbers
  • Description: Given an array of integers, find the longest subarray where the absolute difference between any two elements is less than or equal to 1.
  • Solution: PickingNumbers.cs
  • Unit Tests: PickingNumbersTests.cs
  1. Cats and a Mouse
  • Description: 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 does not 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.
  • Solution: CatsAndAMouse.cs
  • Unit Tests: CatsAndAMouseTests.cs

Medium Problems

  1. Sparse Arrays
  • Description: There is a collection of input strings and a collection of query strings. For each query string, determine how many times it occurs in the list of input strings. Return an array of the results.
  • Solution: SparseArrays.cs
  • Unit Tests: SparseArraysTests.cs
  1. Balanced Brackets
  • Description: Given n strings of brackets, determine whether each sequence of brackets is balanced. Return YES, if the string is balanced. Otherwise, return NO.
  • Solution: BalancedBrackets.cs
  • Unit Tests: BalancedBracketsTests.cs

Hard Problems

  1. Array Manipulation
  • Description: Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each the array element between two given indices, inclusive. Once all operations have been performed, return the maximum value in the array.
  • Solution: ArrayManipulation.cs
  • Unit Tests: ArrayManipulationTests.cs

Feel free to explore the solutions in the respective directories for each problem.

Contributing

Contributions to this repository are welcome! If you would like to add solutions for more problems or improve existing solutions, follow these steps:

  1. Fork the repository.
  2. Create a new branch for your contribution.
  3. Implement your solution or make the desired improvements.
  4. Test your code to ensure it works correctly.
  5. Commit your changes with descriptive commit messages.
  6. Push your branch to your forked repository.
  7. Submit a pull request to the main repository.

Please ensure your code follows good coding practices and include any necessary documentation or explanations.

License

This project is licensed under the MIT License.

About

It is a simple repo to practice problem-solving on the HackerRank website.


Languages

Language:C# 100.0%