Count Possible Triangles | GFG Solution | Searching and Sorting

Sdílet
Vložit
  • čas přidán 7. 06. 2021
  • 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. Question Statement:
    Given an unsorted array arr[] of n positive integers. Find the number of triangles that can be formed with three different array elements as lengths of three sides of triangles.
    Topic: #Array #GFG #SearchingAndSorting
    Used #DataStructure: #Array
    #TimeComplexity: O(N^2) , where N is total number of elements and S is array sum.
    #SpaceComplexity: O(1)
    ----------------------------------------------------------------
    For detailed information and other exercises, VISIT: www.pepcoding.com
    Have a look at our result: www.pepcoding.com/placements​
    Follow us on our FB page: / pepcoding​
    Follow us on Instagram: / pepcoding​
    Follow us on LinkedIn: / pepcoding-education
    ----------------------------------------------------------------
    #Array #leetcode #GFG #SearchingAndSorting

Komentáře • 46

  • @ananyaarya2465
    @ananyaarya2465 Před 3 lety +13

    sumeet sir k baad ye didi sabse acha samjhati hai

    • @Pepcoding
      @Pepcoding  Před 3 lety +3

      wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit.

  • @nirbhaysingh4360
    @nirbhaysingh4360 Před 3 lety +11

    Wow this is the best explanation i have found just after a while, thanks a lot😊

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Glad to know that you liked the content and thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

  • @nileshbahetwar2816
    @nileshbahetwar2816 Před rokem

    Every pepcoders "like pro", after seeing soln we get confident that ,coding is definately our cup of tea. Thank yuo mam...

  • @ShivangiSingh-wc3gk
    @ShivangiSingh-wc3gk Před rokem +1

    Very good explanation, thank you so much

  • @manojgollapelli9856
    @manojgollapelli9856 Před rokem

    Awesome Teaching Mam, thanks a lot🙌🤞

  • @divyanshuchaudhari3257
    @divyanshuchaudhari3257 Před 2 lety +2

    Great explanation Manisha..Keep doing the good work.

  • @VikasGupta-ok9lh
    @VikasGupta-ok9lh Před rokem

    Very nice explaination mam

  • @yashrtajane4680
    @yashrtajane4680 Před 2 lety +2

    Excellent work keep it up ⚡💯♥️

  • @sajramkisho9991
    @sajramkisho9991 Před 2 lety +1

    Though it is in hindi.... i completely understood the explanation .. Thanks :)

  • @lawhenfan6252
    @lawhenfan6252 Před 3 lety +4

    wow. this is the best explanation. really very very nicely explained. she is such a star.

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

  • @friendsav1244
    @friendsav1244 Před 2 lety +1

    thanks di, best explanation.

  • @soniamalik4929
    @soniamalik4929 Před 2 lety +1

    Manisha mam.......you teach awesome

  • @BACSShaileshShettar
    @BACSShaileshShettar Před 6 měsíci

    explained soo goood

  • @ayushkadyan7261
    @ayushkadyan7261 Před rokem

    great work mam

  • @prakhargupta3185
    @prakhargupta3185 Před rokem +1

    nicely explained

  • @nikhilnischal4019
    @nikhilnischal4019 Před 2 lety +1

    Best explaination

  • @priya_kumari7893
    @priya_kumari7893 Před 3 lety +3

    Hey ! thik hai Ji
    love your explanation, best on the internet

  • @amanahmed6057
    @amanahmed6057 Před 3 lety +2

    me toh madam ko chilaa chilaa kar keh raha thaa ki
    left+right > i
    me soch raha
    mam bol kuch rahi or kar kuch or rahi
    PAR
    SABSE BEST EXPLAINATION HAI OR RAHEGI

    • @Pepcoding
      @Pepcoding  Před 3 lety

      wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit.

    • @manishapawar3471
      @manishapawar3471 Před 3 lety +1

      Sunai nhi diya , warna submit karne se pehle theek kar deti. 😂

    • @amanahmed6057
      @amanahmed6057 Před 2 lety

      @@manishapawar3471 💯💯

  • @asithakamalreddy436
    @asithakamalreddy436 Před 3 lety +2

    Great explanation

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Keep learning, Keep growing and keep loving Pepcoding!😊

  • @easylearning6647
    @easylearning6647 Před rokem

    ok ji

  • @LegitGamer2345
    @LegitGamer2345 Před 3 lety +1

    Nice explanation

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thanks for liking and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @srujanwankhede5314
    @srujanwankhede5314 Před 2 lety +1

    thanks didi well explained

    • @Pepcoding
      @Pepcoding  Před 2 lety

      My pleasure 😊
      For better experience and curated content sign up on nados.io and keep learning.

  • @ANURAGSINGHBCG
    @ANURAGSINGHBCG Před 3 lety +1

    good explanation

  • @poonamchauhan1884
    @poonamchauhan1884 Před 3 lety +2

    why are we doing r-- when we're doing (r-l) wouldn't it include all possibilities? Can you explain the logic behind doing so?

    • @shrey6356
      @shrey6356 Před 3 lety +1

      arre kyun ki........ [1,2,3,4] suppose karo ki aapne 4 biggest consider kari .....1 s 3 tk aap baaki do sides ki possibilities dekh ri ho....ab 4 fix h...orr pehle aap ne dusri side 3 maani orr uske hisab se possibilities nikal lin...ab aap dusri side 2 maanogi uske hisab s aapko dobara possibilities dekhni ...isliye is so called dusri side jo ki 3->2 ho gyi isse change karane k liye hume r-- krna pd rha h.

    • @poonamchauhan1884
      @poonamchauhan1884 Před 3 lety +1

      @@shrey6356 ohh samjhi ache se aamjhaya thanks!

  • @sudhakartripathi3879
    @sudhakartripathi3879 Před 2 lety +1

    thanks mam

    • @Pepcoding
      @Pepcoding  Před 2 lety

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      czcams.com/users/Pepcodingabout?view_as=subscriber

  • @meghakaushik7123
    @meghakaushik7123 Před 3 lety +1

    wow this mam expalin great

  • @fayequehannan2473
    @fayequehannan2473 Před 2 lety

    It will fail for 1,1,1,2,2 in interviewbit...ans is showing 4 but your function returns 3

    • @ayushkadyan7261
      @ayushkadyan7261 Před rokem

      this is c++ code and it gives correct answere for you case as well as for other case as well
      int findNumberOfTriangles(int arr[], int n)
      {
      sort(arr,arr+n);
      int res=0;
      for(int i=2;i

  • @PrashantKumar-fk8le
    @PrashantKumar-fk8le Před 7 měsíci

    well explained

  • @vasudhatapriya6315
    @vasudhatapriya6315 Před 3 lety +2

    Great explanation