Размер видео: 1280 X 720853 X 480640 X 360
Показать панель управления
Автовоспроизведение
Автоповтор
Did it using segtree, later when I figured out a simple two pointer solution, my segtree got offended cause it looked a gaint lmao😁
haha
Can you share me the code?
@@sypher4735 you mean segtree code?
simple code for 2pointer approach ll n; cin>>n; vector v(n); for(ll i=0; i>v[i]; } int min=1; int max=n; ll i=0; ll j=n-1; ll cc=0; ll p=0; while(i
Helpful video sir
Can we use sliding window?..we'll initialize l=0 and r=1 and then traverse?..in each iteration we'll check if r is invalid then increase r else if l is invalid then increment l
Then youll have to check for all values from 1 to n for the length of the sliding window.. the time complexity would be n2
@@Acodedaily #includeusing namespace std; typedef long long ll; int main(){ ll t,n,m,mi=0,ma=0,j,k,a=0,b=0,c=0; cin>>t; // char c; //t=1; //ll arr[3]; while(t--){ cin>>n; ll arr[n]; set sm; set gr; for(ll i=0;i>arr[i]; } ll i=0,j=0; if(n==1||n==2){ cout
Can u pls check it and tell me what's wrong with it😅. it shows wrong answer on pretest 2..
@@Adi-sn2zv could you share the submission link on the discord server?
@@Acodedaily ok sure
``void solve(){ int n; cin>>n; vi vec(n); set st1; rp(i,n){ cin>>vec[i]; st1.insert(vec[i]); } debug(st1); int i=0,j=n-1; while(i
instead of --st.end() u can use st.rbegin()
sir please make video of D
done!.waiting for YT to process.
Did it using segtree, later when I figured out a simple two pointer solution, my segtree got offended cause it looked a gaint lmao😁
haha
Can you share me the code?
@@sypher4735 you mean segtree code?
simple code for 2pointer approach
ll n;
cin>>n;
vector v(n);
for(ll i=0; i>v[i];
}
int min=1;
int max=n;
ll i=0;
ll j=n-1;
ll cc=0;
ll p=0;
while(i
Helpful video sir
Can we use sliding window?..we'll initialize l=0 and r=1 and then traverse?..in each iteration we'll check if r is invalid then increase r else if l is invalid then increment l
Then youll have to check for all values from 1 to n for the length of the sliding window.. the time complexity would be n2
@@Acodedaily
#include
using namespace std;
typedef long long ll;
int main(){
ll t,n,m,mi=0,ma=0,j,k,a=0,b=0,c=0;
cin>>t;
// char c;
//t=1;
//ll arr[3];
while(t--){
cin>>n;
ll arr[n];
set sm;
set gr;
for(ll i=0;i>arr[i];
}
ll i=0,j=0;
if(n==1||n==2){
cout
Can u pls check it and tell me what's wrong with it😅. it shows wrong answer on pretest 2..
@@Adi-sn2zv could you share the submission link on the discord server?
@@Acodedaily ok sure
``void solve()
{
int n;
cin>>n;
vi vec(n);
set st1;
rp(i,n){
cin>>vec[i];
st1.insert(vec[i]);
}
debug(st1);
int i=0,j=n-1;
while(i
instead of --st.end() u can use st.rbegin()
sir please make video of D
done!.waiting for YT to process.