- Practice
- Mathematics
- Fundamentals
- Maximum Draws
- Discussions

# Maximum Draws

# Maximum Draws

- P
programmingevan + 6 comments Does this challenge seem oddly easy to anyone else? Like a warmup exercise?

- SR
Unchained + 0 comments "Warmup" is an over estimation.

- O
Omnikron13 + 1 comment You are not alone. As far as programming is concerned this is just I/O and a single addition, so... 'challenge' isn't the word I'd use to describe this. =P

chestaisokay + 0 comments This was very very easy . I hope there are some good challenges ahead .

c650Alpha + 1 comment I agree. I saw this problem, thought I was overthinking it, and then checked the Discussion to see if I was right.

_faker_ + 1 comment Exactly the same happpened with me!

- AS
aloksingh3007 + 0 comments same here !

RubberSideDown + 0 comments The solution to this challenge is an excellent, basic example of an application of the pigeonhole principle, which definitely Falls under the fundamentals category.

jpjaspreetmahal + 0 comments I am here just to read comments XD

AllisonP + 4 comments This should really be called Maximum Draws (because it's worst-case scenario). Minimum draw would always be 2.

lvsz_ + 1 comment I like the idea of a best worst case scenario.

- A
aigookenzaki + 0 comments ahhmm ahh can you help me to this account cuase i dont understand the terms can you help me plzzz

whyzee + 0 comments Thank you. Thats what I thought too.

Debu_Basu + 0 comments Yeah exactly! It occured to me once, but then it was clear when I saw the sample I/O :)

- A
aigookenzaki + 0 comments ahh i am new in this account i need help cuase i dont understand can you help me pls

- MB
Neon + 5 comments Simple 3 pairs : R,B,G Draw 1 : R1 Draw 2 : B1 Draw 3 : G1 Draw 4 {R2,B2,G2} any of the pick makes a pair with previously picked color :)

revernus + 2 comments Thanks, I was able to understand the problem only after reading your explanation.

gokuvsvegita + 0 comments lol

panindra_ganni27 + 0 comments lol

- SM
sakib_muhit + 1 comment Perfect... :D

chvnikhil + 0 comments good

- MI
codermehraj + 0 comments thanks

- SR
sankireddyvinee1 + 0 comments nice..

panditsaurav6 + 0 comments Just a request is there any way we can write it as permutation and combination problem.

foxtrot + 2 comments I'm surprised nobody mentioned the Pigeonhole Principle :-P

thakursaurabh98 + 0 comments That was the main concept behind the question but still simpler ways! :D

- SG
sachingadagi + 5 comments Am I the only one who did (pairs+ 1) ? :P

shunn789 + 0 comments No.

trendsetter37 + 0 comments No.

M4GNV5 + 0 comments No. ++ ?

badillosoft + 0 comments Yes, you're right :D

num of pairs plus one, because in the worst case you'll get off each one of the different pairs, thus, you should get one more.TheVoidMaster + 0 comments i did that too.

wjm91 + 0 comments This one is really easy. If you have n-pairs of socks, that means that worst case you pick one sock from each pair. From there any sock you choose has to be a match.

So by the pidgeon hole principle we get the answer to just be n+1

Surprisingly basic to be honest

- M
markbinder1234 + 3 comments I have absolutley NO CLUE how to solve this! I'am just shocked at just how many people say it's easy and do it. This problem is just unbielievebly confusing and impossible to understand. I'm new. Probably that's why but still HackerRank should make questions just a tad bit more understandable for people who just joined HackerRank. Please whoever is reading this just please explain the "thing" about HackerRank that everyone knows and uses it to solve these kind of stuff. Fyi I know programming very well. - Mark

- G7
GRAVI7APS + 1 comment import java.io.

*; import java.util.*;public class Solution {

`public static void main(String[] args) { Scanner scan = new Scanner(System.in); // just to remove the first variable int numberOfLines = scan.nextInt(); // the number of draws is the number of pairs + 1 while(scan.hasNext()) { System.out.println(scan.nextInt()+1); } }`

}

- G7
GRAVI7APS + 0 comments the maximum number of draws, just try to count the maximum number of draws when you have 1 pair of socks, the 2 and so on and you will quickly get the pattern. Don't worry, buddy. Sometimes you get stuck with a problem, who anybody seems to solve on the fly and sometimes you solve the hardest problem, that anybody is able to solve.

techniker + 0 comments Well Initially I though that the person has to remove all the socks from the drawer in order to get the last matching sock. Then test cases failed. Thought harder & got it right.

- MC
aoa1usa + 0 comments Draw a picture and keep track of your pairs and draws you need. You should see a pattern after about three rows of data.

- GL
codespinach + 1 comment One line of Python 3:

`[print(int(input()) + 1) for i in range(int(input()))]`

- C
canhascodez + 0 comments Ruby

puts (1..gets.to_i).map {|_| gets.to_i.succ }

Alternately:

puts Array.new(gets.to_i) {|_| gets.to_i.succ }

Or:

gets.to_i.times { puts gets.to_i.succ }

The last is probably most idiomatic.

ajinkyapathak + 0 comments import java.io.

*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*;public class Solution {

`public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int p=sc.nextInt(); int a=p+1; System.out.println(""+a); } }`

}

This Code Runs All Test Cases...

- A
arno_lee + 0 comments It takes more to reason about possible pitfals, because you're like "it cannot be that easy!", the level should be marked as

**Moderate**

Sort 81 Discussions, By:

Please Login in order to post a comment