Will both methods be efficient or 2nd one ? w.r.t CP
LONG LONG INT -> also included
Will both methods be efficient or 2nd one ? w.r.t CP
LONG LONG INT -> also included
hello @prerak_semwal
more or less they will take almost similar time in execution.
the efficiency of code heavily depends on the algorithm that is used
@aman212yadav
but in Method-2 we call the function one time less and the function definition might be time consuming so wonβt the efficiency be affected ?
yeah method two will be bit efficient because of 1 less call.
If u do time complexity analysis then both the method are treated almost same.
let say ur function takes T time then
method one will take O(T) and method 2 will take O(2T) and in time compelxity analysis we ignore constant.
so both ways it is O(T).