Why it is giving wrong input?
Why it is giving wrong input?
This is Question only, I have shared in pic.
You said u are getting partial in it ,so are u getting TLE ,WA, or Segmentation in rest?
WA in 2.
I don’t know why
Explain this
vector freq;
int j=0,k=0;
for(int i=0;i<n;i++)
{
int d=v[i].second;
if(d==a[j])
{
freq.push_back(i);
// k++;
}
}
//just doing for case 3
int f1=freq[0];
int f2=freq[1];
cout<<f1<<endl<<f2<<endl;
for(int i=f1+1;i<f2;i++)
{
char ch=v[i].first;
int itt=v[i].second;
pair<char,int> p;
p=make_pair(ch,itt);
v.erase(v.begin()+i);
if(itt<a[j])
{
v.insert(v.begin(),p);
}
else if(itt>a[j])
{
v.push_back§;
}
}
Also Why ur code isn’t working on sample testcases?
Sir
This is code
And Sample test case pass horhe
50% Overall Score
Ab dekhlo bro plzzz.
Shi code aaya na
" bool b=false;
queue<pair<int,char>> st;
deque<pair<int,char> > dq;
stack<pair<int,char>> en;
for(int j=0;j<v.size();j++){
if(v[j].first==a[i]){
if(b==false){
b=true;
}else{
while(dq.back().first!=a[i]){
pair<int,char> p=dq.back();
dq.pop_back();
if(p.first<a[i])
st.push§;
else
en.push§;
}
}
}"
kuch is trah ka aaya na
Hey @cbcao263
What should be output for this ?
abca
1
2
According to my understanding it should be
a 2 b 1 c 1
b 1 c 1 a 2
Hogya bro yeh Qstn.
Doosre logic se krdiya
Thanks.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

