
Khusbu Sinha wrote:
.
I have to write a method that takes the parameters as `N', `a' and` b' and returns the minimum possible multiple of 'b' as explained above.
Are the numbers sequential? Are they in order?Khusbu Sinha wrote:. . . There are `N' boxes . . . each containing different number of balls. . . .
Practice only makes habit, only perfect practice makes perfect.—every music teacher ever
Practice mindfully by doing the right things and doing things right.— Junilu
[How to Ask Questions] [How to Answer Questions]
Junilu Lacar wrote:
Here's where I'm not so clear. Are you supposed to be given a random number A that's less than N and another random number B? Then you're supposed to pick A elements from R at random then figure out the minimum possible multiple of B you can get from those A numbers?
Junilu Lacar wrote: Some clarifying questions: Do you have to use all of the A numbers you randomly pick from array R to find that minimum multiple of B? Can you use them only once or can I use each of them multiple times if I have to?
Junilu Lacar wrote: Are you limited to the kind of arithmetic operations you can use to compute the minimum multiple? In your example of 1, 4, and 5 to calculate 10 as the minimum multiple of 5, the most obvious operation used there was just addition. That is, 1 + 4 + 5 = 10. So you can only do addition? What if the numbers don't add up to any multiple of B?
Junilu Lacar wrote:Let's take another example. What if R = {0..50} and A = 3 and B = 13. Then what if the three numbers I randomly picked from R are {1, 17, and 23}. How am I supposed to calculate a minimum multiple of 13 from these three numbers? What would be the output of the program in this case?
Khusbu Sinha wrote:
Junilu Lacar wrote: Some clarifying questions: Do you have to use all of the A numbers you randomly pick from array R to find that minimum multiple of B? Can you use them only once or can I use each of them multiple times if I have to?
Each combination of A numbers randomly picked can be used only once.
Practice only makes habit, only perfect practice makes perfect.—every music teacher ever
Practice mindfully by doing the right things and doing things right.— Junilu
[How to Ask Questions] [How to Answer Questions]
Practice only makes habit, only perfect practice makes perfect.—every music teacher ever
Practice mindfully by doing the right things and doing things right.— Junilu
[How to Ask Questions] [How to Answer Questions]
Practice only makes habit, only perfect practice makes perfect.—every music teacher ever
Practice mindfully by doing the right things and doing things right.— Junilu
[How to Ask Questions] [How to Answer Questions]
Beware: that is going to go into exponential complexity and it will take a very long time to iterate every subset of a large array.Khusbu Sinha wrote:. . . 'a' number of subsets.
Practice only makes habit, only perfect practice makes perfect.—every music teacher ever
Practice mindfully by doing the right things and doing things right.— Junilu
[How to Ask Questions] [How to Answer Questions]
Practice only makes habit, only perfect practice makes perfect.—every music teacher ever
Practice mindfully by doing the right things and doing things right.— Junilu
[How to Ask Questions] [How to Answer Questions]
Practice only makes habit, only perfect practice makes perfect.—every music teacher ever
Practice mindfully by doing the right things and doing things right.— Junilu
[How to Ask Questions] [How to Answer Questions]
Practice only makes habit, only perfect practice makes perfect.—every music teacher ever
Practice mindfully by doing the right things and doing things right.— Junilu
[How to Ask Questions] [How to Answer Questions]
Junilu Lacar wrote: I'm not following how calling the multiple method in a loop can result in different values being returned and added to that list on line 18. It doesn't seem like you have the algorithm clearly understood yet and that's reflected in the incoherence of the code.
Practice only makes habit, only perfect practice makes perfect.—every music teacher ever
Practice mindfully by doing the right things and doing things right.— Junilu
[How to Ask Questions] [How to Answer Questions]
Practice only makes habit, only perfect practice makes perfect.—every music teacher ever
Practice mindfully by doing the right things and doing things right.— Junilu
[How to Ask Questions] [How to Answer Questions]
Practice only makes habit, only perfect practice makes perfect.—every music teacher ever
Practice mindfully by doing the right things and doing things right.— Junilu
[How to Ask Questions] [How to Answer Questions]
Junilu Lacar wrote:Your swap method does not work. You can't do it like that because parameters in Java are passed by value.
All things are lawful, but not all things are profitable.
Practice only makes habit, only perfect practice makes perfect.—every music teacher ever
Practice mindfully by doing the right things and doing things right.— Junilu
[How to Ask Questions] [How to Answer Questions]
All of the world's problems can be solved in a garden  Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDBOpenSourceNoSQLDatabase
