Solution of the problem

solving these problem using 2 pointer approach after sorting it.Continuously showing TLE .How to avoid TLE?

hello @Senjuti256
pls save ur code here -> https://ide.codingblocks.com/
and share the link with me

#include #include using namespace std; void pattern(int *a,int target,int n) { int sum; int strt=0,end=n-1; sort(a,a+n); while(strt<end) { sum=strt+end; if(sum==target) { cout<<a[strt]<<" and "<<a[end]; } else if(sum>target) { end–; } else if(sum<target) { strt++; } } } int main() { int n; cin>>n; int target,a[n]; //int sum; for(int i=0;i<n;i++) { cin>>a[i]; } cin>>target; //sort(a,a+n); //int strt=0,end=n-1; pattern(a,target,n); return 0; }


this is how ur code is rendering.

pls save ur code on cb ide and then share the link with me.

i have saved my code.How to share it here?Options are there to share via email.

go to the link , that i shared.
and then paste ur code in the editor.
now click on file option given on top .
there u will find save button , click on it ,
a new link will be generated , share that generated link with me

i have saved my code on the coding blocks ide.Name of the saved file is code.cpp

bro share that link ,
i cant acces it by name

i cannot find any link there only a save button is coming.Then a msg is displayed that code saved to server.

i have already shared ur updated code in chat box.pls check