Count Possible Triangles | GFG Solution | Searching and Sorting
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
sumeet sir k baad ye didi sabse acha samjhati hai
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.
Wow this is the best explanation i have found just after a while, thanks a lot😊
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😊
Every pepcoders "like pro", after seeing soln we get confident that ,coding is definately our cup of tea. Thank yuo mam...
Very good explanation, thank you so much
Awesome Teaching Mam, thanks a lot🙌🤞
Great explanation Manisha..Keep doing the good work.
Very nice explaination mam
Excellent work keep it up ⚡💯♥️
Though it is in hindi.... i completely understood the explanation .. Thanks :)
wow. this is the best explanation. really very very nicely explained. she is such a star.
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😊
thanks di, best explanation.
Manisha mam.......you teach awesome
explained soo goood
great work mam
nicely explained
Best explaination
Hey ! thik hai Ji
love your explanation, best on the internet
Thank you so much 😀
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
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.
Sunai nhi diya , warna submit karne se pehle theek kar deti. 😂
@@manishapawar3471 💯💯
Great explanation
Keep learning, Keep growing and keep loving Pepcoding!😊
ok ji
Nice explanation
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 )
thanks didi well explained
My pleasure 😊
For better experience and curated content sign up on nados.io and keep learning.
good explanation
Thanks and welcome
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?
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.
@@shrey6356 ohh samjhi ache se aamjhaya thanks!
thanks mam
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
wow this mam expalin great
Glad you liked it
It will fail for 1,1,1,2,2 in interviewbit...ans is showing 4 but your function returns 3
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
well explained
Great explanation
Glad it was helpful!