rohanp's Algorithm Implementations

I have contributed 6 implementations!

Visit Github Profile
  • 10 harshad number

    python

    Puzzle: A Harshad Number, in a given number base, is an integer that is divisible by the sum of its digit when written in that base. Write a function that returns whether an integer is a Harshad Number or not (in base 10). Solution: Of the numbers ...

  • 100 doors problem

    python

    Puzzle: There are 100 doors in a long hallway. They are all closed. The first time you walk by each door, you open it. The second time around, you close every second door (since they are all opened). On the third pass you stop at every third door and ...

  • 99 bottles problem

    python

    # 99 Bottles of Beer # ## Puzzle: ## You must print the lyric of the song as follows: ``` 99 bottles of beer on the wall, 99 bottles of beer. Take one down and pass it around, 98 bottles of beer on the wall. 98 bottles of beer on the wall, 98 ...

  • binary search

    python

    In computer science, binary search, also known as half-interval search or logarithmic search, is a search algorithm that finds the position of a target value, whether alone or part of a record as a key, within a sorted array. It works by comparing the ...

  • caesar cipher

    python

    In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the ...

  • factorial

    python

    In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,The value of 0! is 1, according to the convention for an empty product.The factorial operation is ...