0
What will be the O(1) solution for accepting only those numbers from array which are divisible by 'a' and 'b' but not by both?
'a','b' and array should be taken from user as input.
1 ответ
+ 3
I don't think there is an O(1) solution, you have to iterate over the entire array once in order to know what is in it in the first place which makes it an O(n) solution.