From the statement we can understand that our answer is not greater than 106 and we have to find the smallest positive number which is divisible by A and B, So now we can start a loop from 1 to 106 and find our answer.

Time complexity: O(T106T*10^6)

Space complexity: O(11)

Statistics

68% Solution Ratio
abu_fayeemEarliest, Mar '22
user.404682Fastest, 0.0s
abu_fayeemLightest, 131 kB
Nusab19Shortest, 77B
Toph uses cookies. By continuing you agree to our Cookie Policy.