Skip to content

Latest commit

 

History

History
41 lines (37 loc) · 2.96 KB

Add.md

File metadata and controls

41 lines (37 loc) · 2.96 KB

🔷 Add Challenge:

Challenge description

Write a function that returns the sum of two numbers.

Example

For param1 = 1 and param2 = 2, the output should be
solution(param1, param2) = 3.

Input/Output

  • [execution time limit] 4 seconds (js)

  • [memory limit] 1 GB

  • [input] integer param1

    Guaranteed constraints:
    -1000 ≤ param1 ≤ 1000.

  • [input] integer param2

    Guaranteed constraints:
    -1000 ≤ param2 ≤ 1000.

  • [output] integer

    The sum of the two inputs.

Solutions:

  • JS solution

    function solution(param1, param2){
    return param1 + param2;
    }
    console.log(" 1 + 1 == " + solution(1, 1))
    console.log(" -1000 + -1000 == " + solution(-1000, -1000))
    JS Execution

  • Java solution

    public class Add {
    public static int solution(int param1, int param2){
    return param1 + param2;
    }
    public static void main(String args[]){
    System.out.println(" 1 + 1 == " + solution(1, 1));
    System.out.println(" -1000 + -1000 == " + solution(-1000, -1000));
    }
    }
    Java Execution