Posts

Showing posts with the label Lift queries

HackerEarth's basic programming solutions( Split houses, e-maze-in, Bricks Game, Lift queries ) :

Problem 11: Split houses 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 , x , f = 0 ;     string s , p ;     cin >> n >> s ;     p = s ; //p=string same as string s      for ( int i = 0 ; i < n ; i ++)      {          if ( s [ i ]== '.' )          {             s [ i ]= 'B' ; //replacing all dots with a fence i.e B          }      }     x = p . compare ( s ); //comparing the updated string s with the original string  ...