Problem C. Dora and Search | codeforces round 852

Поделиться
HTML-код
  • Опубликовано: 18 сен 2024
  • #codeforcessolutions
    #codeforces
    Common discord group- / discord
    (Beginners) The new coders- / discord
    (Intermediate) Pro coders- / discord
    #coding
    #cp
    #cf

Комментарии • 19

  • @DawnCoder
    @DawnCoder Год назад +5

    Did it using segtree, later when I figured out a simple two pointer solution, my segtree got offended cause it looked a gaint lmao😁

  • @kshitijgupta9903
    @kshitijgupta9903 11 месяцев назад +1

    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

  • @aryamankumar645
    @aryamankumar645 Год назад +1

    Helpful video sir

  • @Adi-sn2zv
    @Adi-sn2zv Год назад +2

    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

    • @Acodedaily
      @Acodedaily  Год назад +2

      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

    • @Adi-sn2zv
      @Adi-sn2zv Год назад

      @@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

    • @Adi-sn2zv
      @Adi-sn2zv Год назад +1

      Can u pls check it and tell me what's wrong with it😅. it shows wrong answer on pretest 2..

    • @Acodedaily
      @Acodedaily  Год назад +1

      @@Adi-sn2zv could you share the submission link on the discord server?

    • @Adi-sn2zv
      @Adi-sn2zv Год назад

      @@Acodedaily ok sure

  • @hardikg6858
    @hardikg6858 Год назад +3

    ``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

  • @rockingbadshah1848
    @rockingbadshah1848 Год назад +1

    sir please make video of D

    • @Acodedaily
      @Acodedaily  Год назад +2

      done!.waiting for YT to process.