DSA Day 50/100

DSA Day 50/100

Topic: Mathematical

Questions Successfully Completed: 1

1) Addition under Modulo

Easy

Addition under Modulo

    public static long sumUnderModulo(long a, long b){
        // ((a%g)+(b%g))%g
        long g = 1000000007;
        long q = a%g;
        long p = b%g;
        long finalresult = (q+p)%g;
        return finalresult;
    }

Thank you for reading :)