Count of Equivalent Subarrays | Hashmap Interview Questions

Поділитися
Вставка
  • Опубліковано 19 жов 2024
  • Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
    NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this video, we discuss the count of equivalent subarrays problem using hashmaps in java. In this problem,
    1. You are given an array of integers(arr).
    2. You have to find the count of equivalent subarrays.
    3. A subarray is equivalent if,
    count of unique integers in the subarray = count of unique integers in the given array.
    To attempt and submit this question, click here: www.pepcoding....
    For a better experience and more exercises, VISIT: www.pepcoding....
    #hashmaps #datastructure #algorithms
    Have a look at our result: www.pepcoding....
    Follow us on our FB page: / pepcoding
    Follow us on Instagram: / pepcoding
    Follow us on LinkedIn: / pepcoding-education

КОМЕНТАРІ • 13

  • @Anand14527
    @Anand14527 2 роки тому +1

    Amazing explanation..These questions are tricky one and only you can explain these things in lucid way.

  • @ashwinnema06
    @ashwinnema06 Рік тому

    Sir I hope that ad revenue you are earning through these videos is enough to support you.

  • @navpreetkaur9620
    @navpreetkaur9620 3 роки тому

    Sir why are you adding arr. Len - i in answer, why not just incrementing ans variable????

  • @SumitSingh-ui4do
    @SumitSingh-ui4do 2 роки тому

    Great sir❤️❤️❤️❤️

    • @Pepcoding
      @Pepcoding  2 роки тому

      Glad you liked it!
      Keep learning.
      And for better experience and well organised content visit nados.pepcoding.com

  • @PraveshGupta1992
    @PraveshGupta1992 4 роки тому +2

    Is this Not Same as Count Substrings with K Distinct Characters ? Can we do these two problems with one solution ?

    • @exodus5948
      @exodus5948 3 роки тому +2

      Yes

    • @LegitGamer2345
      @LegitGamer2345 3 роки тому

      yeah its same thats what i did

    • @LegitGamer2345
      @LegitGamer2345 3 роки тому

      but why do u wanna write that complex code when you can write this simple code that will be much easier

    • @nikhilchandna4851
      @nikhilchandna4851 3 роки тому +1

      No
      In this question K is always equal to maximum unique character ,
      whereas in Count Substrings with K Distinct Characters K range is 1=

    • @adityaanand5768
      @adityaanand5768 3 роки тому

      Nope both are different questions. Here value of k is fix, that is number of distinct characters present in the whole string but that question(k distinct substring) can have a random value of k. Here the value of k was fix, so after acquiring k unique characters, you can safely say the substring substr(j, i) and the substrings lying after that will have repeate characters because 'k' in this questions was the maximum unique characters that can be found. But in the question, count substring with k unique chars, k was random and hence you can't safely say that after acquiring k chars, the substring lying beyond that will also have repeated chars

  • @santoshkumar-sh3sb
    @santoshkumar-sh3sb 4 роки тому +1

    last test case with 10,000 elements is failing in c++