Click here to Skip to main content
15,888,610 members
Home / Discussions / Java
   

Java

 
AnswerRe: Pattern Pin
Richard MacCutchan14-Feb-14 0:47
mveRichard MacCutchan14-Feb-14 0:47 
GeneralRe: Pattern Pin
V$ethi15-Feb-14 5:01
V$ethi15-Feb-14 5:01 
QuestionRe: Pattern Pin
Richard MacCutchan15-Feb-14 6:03
mveRichard MacCutchan15-Feb-14 6:03 
AnswerRe: Pattern Pin
V$ethi15-Feb-14 16:25
V$ethi15-Feb-14 16:25 
GeneralRe: Pattern Pin
Richard MacCutchan15-Feb-14 21:11
mveRichard MacCutchan15-Feb-14 21:11 
GeneralRe: Pattern Pin
chronodekar17-Feb-14 21:18
chronodekar17-Feb-14 21:18 
GeneralRe: Pattern Pin
Richard MacCutchan17-Feb-14 21:30
mveRichard MacCutchan17-Feb-14 21:30 
GeneralRe: Pattern Pin
chronodekar18-Feb-14 3:40
chronodekar18-Feb-14 3:40 
There might be a more efficient way of doing it, but here's my thinking.

1. Arrange all the numbers in descending order. Make note of the largest one ( = A). Also store the numbers in an array ( = ARRAY)
2. Count the number of inputs ( = B).
3. Visualize the output in the form of a rectangle - you need to draw (with ASCII) a rectangle whose height is A and width B. Alternatively, you need to print A no. of lines with B characters.

Now we come to implementation. In pseudo-code;
Java
for (i = A ; i>0; i--) 
{
    for (j = 0; j<B; j++)
    {
        if (ARRAY(j) > i)
            print("*");
        else
            print("O");
    }
    print("\n");    
}


I think that should do it. Any edge case I missed?

-chronodekar
AnswerRe: Pattern Pin
jschell14-Feb-14 10:30
jschell14-Feb-14 10:30 
GeneralRe: Pattern Pin
V$ethi15-Feb-14 5:07
V$ethi15-Feb-14 5:07 
QuestionHow to encrypt old data instead of using jasyptHibernateEncryptorin Pin
Member 1058731510-Feb-14 21:50
Member 1058731510-Feb-14 21:50 
QuestionSystem timezone Pin
Hans Ruck9-Feb-14 22:06
Hans Ruck9-Feb-14 22:06 
AnswerRe: System timezone Pin
Richard MacCutchan9-Feb-14 22:47
mveRichard MacCutchan9-Feb-14 22:47 
GeneralRe: System timezone Pin
Hans Ruck9-Feb-14 23:20
Hans Ruck9-Feb-14 23:20 
GeneralRe: System timezone Pin
Richard MacCutchan10-Feb-14 0:06
mveRichard MacCutchan10-Feb-14 0:06 
AnswerRe: System timezone Pin
jschell10-Feb-14 8:18
jschell10-Feb-14 8:18 
GeneralRe: System timezone Pin
Bernhard Hiller10-Feb-14 21:34
Bernhard Hiller10-Feb-14 21:34 
GeneralRe: System timezone Pin
jschell11-Feb-14 11:10
jschell11-Feb-14 11:10 
GeneralRe: System timezone Pin
Bernhard Hiller11-Feb-14 20:14
Bernhard Hiller11-Feb-14 20:14 
GeneralRe: System timezone Pin
Richard MacCutchan11-Feb-14 21:56
mveRichard MacCutchan11-Feb-14 21:56 
GeneralRe: System timezone Pin
jschell12-Feb-14 9:16
jschell12-Feb-14 9:16 
GeneralRe: System timezone Pin
Richard MacCutchan13-Feb-14 2:53
mveRichard MacCutchan13-Feb-14 2:53 
QuestionJava Code for Filling in Random Radio Buttons Pin
Romahn Graham6-Feb-14 4:08
Romahn Graham6-Feb-14 4:08 
GeneralRe: Java Code for Filling in Random Radio Buttons Pin
Richard MacCutchan6-Feb-14 6:20
mveRichard MacCutchan6-Feb-14 6:20 
Questiondatabase for sudoku game Pin
Member 105666313-Feb-14 20:49
Member 105666313-Feb-14 20:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.