Notification

No New notification

Learn to code with PrepInsta

Check PrepInsta Coding Blogs, Core CS, DSA etc

One Subscription, For Everyone

Get 200+ Courses under one Subscription

  • aptitude
  • aws_cloud
  • competitive-coding
  • dbms
  • logical_reasoning
  • operating-system
  • verbal
  • tcs_nqt
  • data_science
  • ethical_hacking
  • dsa
  • verbal
  • basic_coding
  • python
  • cpp
  • java
  • basic_coding
  • python
Explore PrepInsta Prime

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Problem 51

1 comments on “Problem 51”


  • TADEPALLI

    #include
    void swap(int *a,int *b)
    {
    int temp=*a;
    *a=*b;
    *b=temp;
    }
    int main()
    {
    int m;
    scanf(“%d”,&m);
    while(m!=0)
    {
    int n,j,i,count=0;
    scanf(“%d”,&n);
    int arr[n],freq[3];
    for(i=0;i<n;i++)
    scanf("%d",&arr[i]);
    for(i=0;i<n;i++)
    {
    for(j=0;jarr[j+1])
    {
    swap(&arr[j],&arr[j+1]);
    count++;
    }
    }
    }
    if(count%2==0)
    printf(“Yes\n”);
    else
    printf(“No\n”);
    m–;
    }
    return 0;
    }