In this

**HackerEarth Long ATM Queue problem solution**Due to the demonetization move, there is a long queue of people in front of ATMs. Due to the withdrawal limit per person per day, people come in groups to withdraw money. Groups come one by one and line up behind the already present queue. The groups have a strange way of arranging themselves. In a particular group, the group members arrange themselves in increasing order of their height(not necessarily strictly increasing).Swapy observes a long queue standing in front of the ATM near his house. Being a curious kid, he wants to count the total number of groups present in the queue waiting to withdraw money. Since groups are standing behind each other, one cannot differentiate between different groups and the exact count cannot be given. Can you tell him the minimum number of groups that can be observed in the queue?

## HackerEarth Long ATM Queue problem solution.

`#include<bits/stdc++.h>`

using namespace std;

int main()

{

int n;

scanf("%d", &n);

int a[n];

for(int i = 0; i < n; i++)

scanf("%d", &a[i]);

int cnt = 1;

for(int i = 1; i < n; i++)

{

if(a[i]<=a[i-1])

continue;

else

cnt++;

}

printf("%d\n",cnt);

return 0;

}

## 0 Comments