Skip to content

Commit cbbb834

Browse files
committed
c++ code solution for confusing concatenations
1 parent c1438b1 commit cbbb834

File tree

2 files changed

+45
-48
lines changed

2 files changed

+45
-48
lines changed

binarysubtitution1.cpp

Lines changed: 0 additions & 48 deletions
This file was deleted.

confusingconcatenations.cpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//shree ganeshay namah
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
5+
6+
7+
int main()
8+
{
9+
10+
11+
int tt;
12+
cin>>tt;
13+
while(tt--)
14+
{
15+
int n;
16+
cin>>n;
17+
18+
int a[n];
19+
for (int i = 0; i < n; i++)
20+
{
21+
cin>>a[i];
22+
}
23+
int max1 = 0;
24+
for (int i = 0; i < n; i++)
25+
{
26+
if(a[i]>a[max1])
27+
max1 = i;
28+
}
29+
if(max1 == 0){
30+
cout<<-1<<endl;
31+
}
32+
else{
33+
cout<<max1<<endl;
34+
for (int i = 0; i < max1; i++)
35+
cout<<a[i]<<" ";
36+
cout<<endl;
37+
cout<<n-max1<<endl;
38+
for(int i =max1; i<n; i++)
39+
cout<<a[i]<<" ";
40+
cout<<endl;
41+
42+
}
43+
}
44+
return 0;
45+
}

0 commit comments

Comments
 (0)