Although I am not completely sure, but the answer should be O(mn) because the loop is called m times but multiplying by 2 shifts the digits of the other number n so it should be O(mn).
A quick check would be to see if m==1 or n==1. O(mn) fits the bill.
Although I am not completely sure, but the answer should be O(mn) because the loop is called m times but multiplying by 2 shifts the digits of the other number n so it should be O(mn).
A quick check would be to see if m==1 or n==1. O(mn) fits the bill.