Skip to content
TheCScience
TheCScience
  • Engineering Subjects
    • Human Values
    • Computer System Architecture
    • Digital Communication
    • Internet of Things
  • NCERT Solutions
    • Class 12
    • Class 11
  • HackerRank solutions
    • HackerRank Algorithms Problems Solutions
    • HackerRank C solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
TheCScience
TheCScience

HackerRank Solve Me First Problem Solution

Yashwant Parihar, April 9, 2023April 9, 2023

In this post, We are going to solve HackerRank Solve Me First Problem. We need to Complete the function solveMeFirst to compute the sum of two integers.

Example

a=7

b=3

Return 10

Function Description

Complete the solveMeFirst function in the editor below.

solveMeFirst has the following parameters:

  • int a: the first value
  • int b: the second value

Returns

  • int: the sum of a and b
HackerRank Solve Me First Problem Solution
HackerRank Solve Me First Problem Solution

Solve Me First Python Solution

#!/usr/bin/env python

import sys


if __name__ == '__main__':
    A = int(sys.stdin.readline())
    B = int(sys.stdin.readline())
    print(A + B)

Solve Me First Java Solution

import java.io.*;
import java.util.*;

public class Solution {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        Scanner scan=new Scanner(System.in);
        int a=scan.nextInt();
        int b=scan.nextInt();
        int c=a+b;
        System.out.println(c);
    }
}

Solve Me First C Solution

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.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;
}

Solve Me First C++ Solution

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int solveMeFirst(int a, int b)
{
    return a + b;
}

int main()
{
    int num1, num2;
    int sum;
    cin>>num1>>num2;
    sum = solveMeFirst(num1,num2);
    cout<<sum;
    return 0;
}

Solve Me First Javascript Solution

process.stdin.resume();
process.stdin.setEncoding('ascii');

var __input_stdin = "";
var __input_stdin_array = "";
var __input_currentline = 0;

process.stdin.on('data', function (data) {
    __input_stdin += data;
});

function solveMeFirst(a, b) {
    return a+b;
}
process.stdin.on('end', function () {
    __input_stdin_array = __input_stdin.split("\n");
    var res;
    var _a = parseInt(__input_stdin_array[__input_currentline].trim(), 10);
    __input_currentline += 1;
    
    var _b = parseInt(__input_stdin_array[__input_currentline].trim(), 10);
    __input_currentline += 1;
    
    res = solveMeFirst(_a, _b);
    process.stdout.write(""+res+"\n");
    
});

Solve Me First C Sharp Solution

using System;
using System.Collections.Generic;
using System.IO;
class Solution {
    static int solveMeFirst(int a, int b) { 
        return a+b;
    }
    static void Main(String[] args) {
        int val1 = Convert.ToInt32(Console.ReadLine());
        int val2 = Convert.ToInt32(Console.ReadLine());
        int sum = solveMeFirst(val1,val2);
        Console.WriteLine(sum);
    }
}      

Other Problems

  • HackerRank Simple Array Sum Problem Solution
  • HackerRank Compare the Triplets Problem Solution
c C++ HackerRank Solutions java python CcppHackerrank Solutionsjavapython

Post navigation

Previous post
Next post

Leave a Reply

You must be logged in to post a comment.

TheCScience

We at TheCScience.com are working towards the goal to give free education to every person by publishing in dept article about Secondary, Senior-Secondary, and Graduation level subjects.

Pages

About US

Contact US

Privacy Policy

DMCA

Engineering Subjects

Internet of Things

Human Values

Digital Communication

Computer System Architecture

Programming Tutorials

Data Structure and Algorithm

C

Java

NCERT

Class 12th

©2026 TheCScience | WordPress Theme by SuperbThemes