Skip to content

Latest commit

 

History

History
19 lines (8 loc) · 4.02 KB

DansDilemmaREADME.md

File metadata and controls

19 lines (8 loc) · 4.02 KB

Dan's Dilemma

You look over to your neighbor Dan. Since struggling with his confidence and being told some 43 odd times by the instructors that he needs to do better in BlueJ (the first assignment I have given), he's been worried about how future assignment will go for him. He also has some dilemmas to solve. Three to be precise. Even worse, whoever was the buffoon who wrote these questions up left no instructions on what they're looking for except some terrible method names and some tests. Luckily he has you, his fellow other members to guide him in solving his dilemma! Help Dan figure out how to conquer his problems and by doing so, helping the both of you conquer future coding test.

Dilemma Of Two

As you peer over his shoulder to see what's the first problem troubling him, he tells you that he's never been very good at math and also sucks at keeping numbers in his head. But, he was told that given any two numbers, he needs to calculate all possible sums, differences, products, and quotients of those two numbers and come up with how many different numbers those results produce. "That is a tough question," you say. "So if you have 5 and 6, adding 5 to 6 would be 11. Then, subtracting 6 from 5 is -1 and multplying them is 30 and division gets you 5/6. That's four different results right?" Dan looks at you and says "Yeah I thought so too, but the expected is 6 not 4." "Wait what?"... You ponder this for a moment then realize your mistake. "Oh, we forgot that 6 - 5 = 1 and 6 / 5 = 1.2 are other possible results. We can throw out 6 + 5 = 11 and 6 * 5 = 30 as they are not unique from what we did before." Dan, now smiling, perks up and says "That's right! I get it now... but how do we code it?" That's a question you and Dan will have to figure out together.

Dilemma of Three

Having conquered the Dilemma of Two, you and Dan are both happily figuring out the number of unique results of basic arithmetic operations. But, you realize your problems aren't over. As you try to figure out the next problem, your friend Emma comes over and sits down next to the two of you. "Hey guys!" she says. "It looks like you guys are working on the same problem I'm stuck on. Wanna check it out together?" "Of course!" you say, "3 heads are better than 2!" Emma looks delighted and starts to explain the problem. "So I think I know what they want from this one. Its like the last problem, but instead of figuring out how many results any two numbers can shake out, it's three. I've been writing down some possibilities on paper and I've also worked out that they only want us to record the results using two numbers at a time, so we're not multiplying all three numbers together for example, we'd only multiply number 1 with number 2, number 1 with number 3, and number 2 with number 3 and recording those results. Remember though, they still have to be unique to count!" Dan, astonished by Emma's clever discovery and wit says "Wow Emma! You sure know a lot! How are you still stuck on this?" Emma replys "Well you see... I know what they want, I'm just having a real hard time putting it into code." Jokes were said, laughs were had... it's literally past midnight irl so fill in the rest of the story here how you see fit as the three of you dive into the Dilemma of Three.

Dilemma of N

By putting your heads together, you, Dan, and Emma have overcome the Dilemma of Two and Three and are staring at the last problem and its tests confused and confuzzled. "They want us to do what?!?!" Dan says. Quick to respond, Emma says "They want us to do what we did with the previous two problems, but now with an unknown number of parameters or arguments." "What kind of jerk even needs to find out answers to questions like this anyways?" Dan replies, "I don't have enough space in my head to keep track of what needs to happen." As he says this, what seems like half the batch has migrated over to your area and are now puzzling about the same problem, almost too many people to count. Maybe this collection of minds is just what you all need to solve this challenge.