Video není dostupné.
Omlouváme se.

Leetcode Weekly Contest 407 | Video Solutions - A to D | by Viraj Chandra| TLE Eliminators

Sdílet
Vložit
  • čas přidán 6. 09. 2024

Komentáře • 14

  • @TLE_Eliminators
    @TLE_Eliminators  Před měsícem

    🎓 Learn from the best! TLE 11.0 offers live classes with top mentors. Join TLE 11.0 today at www.tle-eliminators.com

  • @iitjee258
    @iitjee258 Před měsícem +2

    Oh god, you are just an excellent teacher, literally you have the best way of explaining how it works. Thanks a lot for this editorial

  • @anshulsharma3137
    @anshulsharma3137 Před měsícem +5

    Amazing explanation for the 4th problem. But I feel code could have been more concise. Please check below implementation with same idea as yours.
    class Solution {
    public:
    long long tetrisVal(int start, int end, vector&diff){
    long long val = abs(diff[start]);
    for(int i=start+1;iabs(diff[i-1]))val+=abs(diff[i])-abs(diff[i-1]);
    }
    return val;
    }
    long long minimumOperations(vector& nums, vector& target) {
    vectordiff;
    long long ans = 0, n = nums.size(), start = 0;
    for(int i=0;i0 || diff[i]

    • @VirajChandra
      @VirajChandra Před měsícem +1

      This is great! To keep it extra detailed, I prefer to go for big solutions. But this will work too.

  • @mohdammar8257
    @mohdammar8257 Před 26 dny

    The explanation of 4th problem was amazing .

  • @sarthakawasthi5686
    @sarthakawasthi5686 Před měsícem +1

    Please discuss biweekly solutions too.

  • @ritik6095
    @ritik6095 Před měsícem

    i thought the same idea, but was not able to think prefixsum can be applied to optimize it

  • @blitztour5924
    @blitztour5924 Před měsícem

    Amazing Explanation

  • @priyanshkumar17
    @priyanshkumar17 Před měsícem

    Thank you 🙏🙏😊

  • @TLE_Eliminators
    @TLE_Eliminators  Před měsícem

    Please fill the feedback form: forms.gle/zhg513TvRNcquMd3A

  • @_Keni-Chi
    @_Keni-Chi Před měsícem

    awesome vid
    thanku

  • @sunilpanda2905
    @sunilpanda2905 Před měsícem

    I think the 3rd question can be solved with O(1) space complexity.
    Java code
    ---------------------
    class Solution {
    public int maxOperations(String s) {
    int oneCount = 0, result = 0;
    for(int i = 0 ; i < s.length() - 1 ; i++) {
    char ch = s.charAt(i);
    char nxtCh = s.charAt(i + 1);
    if(ch == '0' && nxtCh == '1')
    result += oneCount;
    if(ch == '1')
    oneCount++;
    }
    if(s.charAt(s.length() - 1) == '0')
    result += oneCount;
    return result;
    }
    }

    • @dhruvsingal5225
      @dhruvsingal5225 Před měsícem

      yeah i have done a similar code in c++
      Here it is:
      int count=0;
      int r=s.size()-1;
      int operations=0;
      while(r>=0 && s[r]=='0'){
      r--;
      }
      if(r!=s.size()-1){
      count++;
      }
      while(r>=0){
      if(s[r]=='1'){
      operations=operations+count;
      int t=r-1;
      while(t>=0 && s[t]!='1'){
      t--;
      }
      if(t!=r-1){
      count=count+1;
      }
      r=t;
      }
      else{
      r--;
      }
      }
      return operations

  • @Sridhar-fd5qr
    @Sridhar-fd5qr Před měsícem