Skip to content
Programmingoneonone
Programmingoneonone
  • Engineering Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
    • 100+ C++ Programs
  • Solutions
    • HackerRank
      • Algorithms Solutions
      • C solutions
      • C++ solutions
      • Java solutions
      • Python solutions
    • Leetcode Solutions
    • HackerEarth Solutions
  • Work with US
Programmingoneonone
Programmingoneonone

HackerRank Solve Me First problem solution

YASH PAL, 31 July 202430 November 2025

In this HackerRank Solve Me First problem solution 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:

  1. int a: the first value
  2. int b: the second value

Returns

– int: the sum of a and b

Hackerrank solve me first solution
Solve me first problem solution

HackerRank solve me first solution in Python.

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


num1 = int(input())
num2 = int(input())
res = solveMeFirst(num1,num2)
print(res)

 

Solve me first solution in Java.

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {

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

   
 public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int _a = in.nextInt();
        int _b = in.nextInt();
        int sum = solveMeFirst(_a, _b);
        System.out.println(sum);
   }
}

 

Solve me first solution in C++.

#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 solution in C.

#include <stdio.h>
#include <stdlib.h>


int main() {
  int num1,num2,sum;
  scanf("%d %d",&num1,&num2);
  sum = num1+num2;
  printf("%d",sum);
  return 0;
}

Solve me first solution in JavaScript.

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

var input = "";

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


process.stdin.on('end', function () {
    var inputArray = input.split("n");
    var res;
    var a = parseInt(inputArray[0], 10);
    var b = parseInt(inputArray[1], 10);
    console.log(a+b);
  
});

Other problem solutions

  • HackerRank Simple Array Sum problem solution
  • HackerRank Compare the triplets problem solution
  • HackerRank A very big sum problem solution
  • HackerRank Diagonal difference problem solution
  • HackerRank Plus minus problem solution
Algorithms coding problems solutions AlgorithmsHackerRank

Post navigation

Previous post
Next post

Leave a Reply

Your email address will not be published. Required fields are marked *

Programmingoneonone

We at Programmingoneonone, also known as Programming101 is a learning hub of programming and other related stuff. We provide free learning tutorials/articles related to programming and other technical stuff to people who are eager to learn about it.

Pages

  • About US
  • Contact US
  • Privacy Policy

Practice

  • Java
  • C++
  • C

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes