Questions tagged [triplet]

63 questions
-2
votes
3 answers

How to generate combination of numbers in more optimized way in Java?

I had a problem statement which requires passing 3 different numbers to a method and checking which 3 numbers satisfies a certain constraint. Here is my code, but I wanted to know instead of creating nested loops, is there any more optimized way of…
Sugyan sahu
  • 129
  • 1
  • 8
-3
votes
3 answers

Pythagorean Triplet with given sum

The following code prints the pythagorean triplet if it is equal to the input, but the problem is that it takes a long time for large numbers like 90,000 to answer. What can I do to optimize the following code? 1 ≤ n ≤ 90 000 def…
user13181530
-4
votes
1 answer

Find triplet for set, Python

This is my assignment: Find the triplet a, b, c ∈ {x | x ∈ Z and 450 > x > 0} Such that the following relations is satisfied: a = if b is even: c+11 BUT if b is odd: 2c-129 b = (a * c) mod 2377 c = (Sum of b-7k from k=0 to a-1) + 142 This is…
rasperryPi
  • 377
  • 2
  • 4
  • 12
1 2 3 4
5