Posts

Showing posts with the label Arithmetic Progression

HackerEarth's basic programming solutions( VC Pairs, Arithmetic Progression, Database ) :

Problem 18: VC Pairs 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< iostream > using namespace std ; int main () { int t , n ; cin >> t ; while ( t --) { string s ; cin >> n ; cin >> s ; int flag = 0 ; for ( int i = 0 ; i < n ; i ++) { if (( s [ i ]!= 'a' && s [ i ]!= 'e' && s [ i ]!= 'i' && s [ i ]!= 'o' && s [ i ]!= 'u' ) && ( s [ i + 1 ]== 'a' || s [ i + 1 ]== 'e' || s [ i + 1 ]== 'i' || s [ i + 1 ]== 'o' || s [ i + 1 ]== 'u' )) { flag ++; } } cout << flag << "\n" ; } } I know you are wondering what's this big crap written inside the if parenthesis. Well