May 21, 2024 |320 Views

    PROBLEM OF THE DAY : 20/05/2024 | Modular Exponentiation for large numbers

    Description
    Discussion

    Welcome to the daily solving of our PROBLEM OF THE DAY with Nitin Kaplas. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Array but also build up problem-solving skills.

    In this problem, we are given Implement pow(x, n) % M.
    In other words, for a given value of x, n, and M, find  (xn) % M.

    Example :

    Input:
    x = 3, n = 2, m = 4
    Output:
    1
    Explanation:
    32 = 9. 9 % 4 = 1.

    Give the problem a try before going through the video. All the best!!!
    Problem Link: https://www.geeksforgeeks.org/problems/modular-exponentiation-for-large-numbers5537/1