Hackerrank's Problem Solving solutions( Solve Me First, Simple Array Sum, Compare the Triplets ) :
Problem 1: Solve Me First Solution: (in c++) ( please guys before moving to the solution try it yourself at least 3-4 times , if you really wanna become a good coder) #include < bits/stdc++.h > using namespace std ; int solveMeFirst ( int a , int b ) { return a + b ; } int main () { int num1 , num2 ; cin >> num1 >> num2 ; int sum ; sum = solveMeFirst ( num1 , num2 ); cout << sum ; } This code is simple. There's no need for any explanation. Problem 2: Simple Array Sum Solution: (in c++) ( please guys before moving to the solution try it yourself at least 3-4 times , if you really wanna become a good coder) #include< bits/stdc++.h > using namespace std ; int main () { int n , i , j , sum ; cin >> n ; int a [ n ]; for ( i = 0 ; i < n ; i ++) cin >> a [ i ]; sum = 0 ; for ( j = 0 ; j < n ; j ++) { sum = sum + a [ j ]; } cout << sum ; } Thi