Programmers / Common Multiple

Programmers / Common Multiple

Problem

Solution 1

1
2
3
4
5
6
7
8
class Solution {
    public int solution(int number, int n, int m) {
        if ((number % n == 0) && (number % m == 0)) {
            return 1;
        }
        return 0;
    }
}
Solution 1
  • Description
    • Check for common multiple using the modulo operator
  • Time Complexity
    • O(1)
    • Always performs the same operation
  • Space Complexity
    • O(1)
    • Function parameters and local variables