Posts

Showing posts with the label Cost of balloons

HackerEarth's basic programming solutions( Palindromic String, Find Product, Cost of balloons ) :

Problem 4: Palindromic String 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 (){ string s ; cin >> s ; //comparing string s with the reversed string s   if ( s == string ( s . rbegin (), s . rend ())) { cout << "YES" << endl ; } else {     cout << "NO" << endl ; } } Here rbegin() and rend() are string methods.         Problem 5: Find Product 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 ele ;     vector < int > v ; //declared a vector STL      long long int n , i , prod = 1 ;     cin >> n ;      for ( i = 0 ; i < n ; i ++)      {         cin >> ele ;         v . push_back (