We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Mathematics
- Fundamentals
- Handshake
- Discussions
Handshake
Handshake
Sort by
recency
|
336 Discussions
|
Please Login in order to post a comment
For Python3 Platform
Mathematics Logic - Using combinations. Here it is nc2 = n*(n-1)/2
I wrote the code from scratch just to get more practiceYes, the formula n * (n - 1) / 2 works perfectly for this. It’s just the classic combination logic (C(n, 2)). If anyone’s looking for a simple breakdown of similar problem-solving patterns, you can click here for a quick resource I found useful.
Code belove or above most likly will give an error.
Coz Test Case will force you to cast answer to int before return
BRO! Its just a simple Combination Formula for C(N, 2) = N! / 2( N - 2)! = N ( N -1 )/2
You nailed it, happy coding 😍
Java 15