i have used global variable instead of Pair… What is good approach to solve these problem by using pair or using global variable…or simply both are good?
Can you check my implementation of this problem? Whether it runs for all test cases or not?
global variable are easy to use because we dont have to pass it anywhere.they are accessible from anywhere.
but it is risky as well. because they r exposed to all the functions.
try to avoid global variable as much as u can.
to check whether u code is correct or not. u can submit it in ur challenge section or on hackerblocks