Assignment for CS 🥺 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

Assignment for CS 🥺

You are holding a contest to determine the ultimate penny champion. Each participant in the contest has decided which side of the penny they like, heads or tails, and keeps that decision to themselves. We represent heads using the boolean value true and tails using false. The contest participants all get in a long line (array). They start by pairing up (the first two, second two, and so forth). After the two members reveal their pennies to each other, if both are the same, the first (left) person wins, otherwise, the second (right) person wins. The remaining members then battle it out the same way in the next round until only one winner emerges. If there are an odd number of people in any round, the last person gets a “bye” and automatically survives to the following round. Solve the problem recursively by writing the following method: public static int champion(boolean[] a) Return the index corresponding to the winner of the contest. You do not need to allocate any arrays for this problem

22nd Jan 2020, 10:34 PM
Khaoula / Kayla Caty
Khaoula / Kayla Caty - avatar
11 Answers
+ 11
Hello! Do you have an attempt at this problem? If you need help with it, please be specific with what exactly is giving you issues as otherwise there'll be little that can be done to help
23rd Jan 2020, 12:18 AM
Faisal
Faisal - avatar
+ 1
Oh okay, thank you!
23rd Jan 2020, 10:19 PM
Khaoula / Kayla Caty
Khaoula / Kayla Caty - avatar
0
I basically don't know where to start 🥺
23rd Jan 2020, 12:20 AM
Khaoula / Kayla Caty
Khaoula / Kayla Caty - avatar
0
Where is it from? If it is from school, your teacher should have told you the basics of C#. You could check out SL's course to get some help. It explains data types, loops, etc.
23rd Jan 2020, 3:19 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
0
No its java programmint, and we specifically need to use recursion
23rd Jan 2020, 3:24 AM
Khaoula / Kayla Caty
Khaoula / Kayla Caty - avatar
0
Since I find it interesting, I will see what I can do with it in a few hours. I'm not making any promise, tho.
23rd Jan 2020, 3:28 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
0
Okay, thank u so much ❤
23rd Jan 2020, 3:45 AM
Khaoula / Kayla Caty
Khaoula / Kayla Caty - avatar
0
Use this as a blueprint to finish your assignment https://code.sololearn.com/cFz8Zn13NQvE/?ref=app
23rd Jan 2020, 9:20 PM
Fernando Pozzetti
Fernando Pozzetti - avatar
0
Oh wow, did u try it, did it work? is it recursion?
23rd Jan 2020, 9:28 PM
Khaoula / Kayla Caty
Khaoula / Kayla Caty - avatar
0
No, I did not finish it. You will need recursion to ignore the pairs of playera that lose
23rd Jan 2020, 10:16 PM
Fernando Pozzetti
Fernando Pozzetti - avatar
0
Wanna to learn html
25th Jan 2020, 12:48 PM
Pritam Gc