BlackJack Hand Comments


  • This should ask for print out the sum, not return it, right?

  • @Jestin, Yes, Corrected. Thanks!

  • Hi. Can you help me?
    Look at my submission (number 1.).

    For INPUT is shows OK, but for OTHER INPUT is shows incorrect.


  • @Lukas, the challenge now shows the complete I/O table so you can see what you got wrong.

  • thanks, I see it now.
    I did think that I can turn 11 to 1 only one time.
    Because there is written : " should "convert" ONE 11 to 1 and return a.....".

    My english is not perfect.

  • Dear Admin,

    I believe row 7 is incorrect:

    Input is:
    11 11 2 11 11 4

    How can the correct output be 20 if you are only allowed ONCE to change 11 to 1?


  • @David, as many 11's as necessary should be converted to 1's to prevent the sum from being exceeded.

  • In row 3, how can you change the 11 to 1 if you only know that the sum will exceed 21 after the next draw?

    Does this means that you initially count it as an 11 but then, as 10 and 5 appear,

  • @Pierre, in this version of Blackjack, the Ace always has the optimal value, regardless of order (your program ensures this!)

  • I've come up with a solution that is incorrect when I run the code. However when I go into debug, the outputs are all correct. Could this be looked into please?

  • Your recent submission prints incorrect numbers such as 14 instead of 16 for the third case.

  • A solution:

    my code

  • int [] cards=new int[12];
        for(int a:ar){
            cards[a]+=1;// might have to switch to +=a;
        int z=0;
        for(int b=1;b<cards.length;b++){
            int m=b*cards[b];
  • It looks like you're making it more complicated than necessary. To figure out the score, you just need the total sum and the number of elevens. You can then determine how many (If any) elevens

Contact Us
Sign in or email us at [email protected]