Solve Me First

Sort by

recency

|

1032 Discussions

|

  • + 1 comment

    def solve(a, b): return a + b

    Sample Input

    a = 2 b = 3

    Explanation:

    The function solve(a, b) takes two integers.

    It simply returns their sum using the + operator.

    For a = 2 and b = 3, it returns 5. ✅

    Sample Output

    print(solve(a, b)) # Output: 5

  • + 0 comments

    The typescript initial code is incomplete!

  • + 0 comments
    #include <stdio.h>
    
    int solveMeFirst(int a, int b) {
        return a + b;
     
    }
    
    int main() {
        int num1,num2;
        scanf("%d %d",&num1,&num2);
        int sum; 
        sum = solveMeFirst(num1,num2);
        printf("%d",sum);
        return 0;
    }
    
  • + 0 comments

    There is no way i found for the answer... using typescript i declared a function and when I call the function for (2,3) it is true but (100,1000) false. When I call two functions it is false again and I cannot submit it. Is there anyone who did it right??? WASE

  • + 0 comments

    Bash Solution:

    solveMeFirst() {
      local a=$1
      local b=$2
    
      
      if (( a < 1 || b > 1000 )); then
        echo "Error: inputs must be in range 1..1000" >&2
        exit 1
      fi
    
      # print the sum
      echo $(( a + b ))
    }
    
    # read two numbers (space- or newline-separated)
    read -r a
    read -r b
    
    solveMeFirst "$a" "$b"