Post

[Programmers] #120804 - 두 수의 곱 구하기 [Java][C++][Python]

정수 num1과 num2를 곱한 값을 그대로 반환하는 워밍업 문제.

[Programmers] #120804 - 두 수의 곱 구하기 [Java][C++][Python]

문제 링크


1. 아이디어

정수 num1, num2가 주어질 때, 두 수의 곱을 반환하면 되는 간단한 문제다.


2. 복잡도

접근시간공간
풀이$O(1)$$O(1)$

3. 코드

풀이 [Java][C++][Python]

1
2
3
4
5
class Solution {
    public int solution(int num1, int num2) {
        return num1 * num2;
    }
}
1
2
3
4
5
6
#include <bits/stdc++.h>
using namespace std;

int solution(int num1, int num2) {
    return num1 * num2;
}
1
2
def solution(num1, num2):
    return num1 * num2

This post is licensed under CC BY 4.0 by the author.