Hackerrank Nov Challenge – Power of Large Numbers

PROBLEM STATEMENT

In a nutshell, we have a^b mod 10^9 + 7 ( ^ denotes power )

Range of a & b: 1 <= a,b <= 10^100000

PRE – REQUISITES

FERMAT’S THEOREM:

The theorem stats that, if is a prime number, then for any arbitrary integer 

a^p \equiv a \pmod p.

Continue reading

Hackerrank 101oct Halloween party

PROBLEM STATEMENT:

You are given a very large rectangular chocolate bar. You must cut only as 1 x 1 pieces. You are allowed to do only ‘K’ cuts at the maximum. What is maximum number of chocolate pieces can u cut ?

For a detailed problem statement click here

Continue reading