Skip to content

Comments

[BE] ํ•œ์Šนํ˜„ ๐Ÿ‘ฅ ์˜ค๋Š˜์˜ ์ง๊ฟ์€?#22

Open
1winhyun wants to merge 1 commit intoLeets-Official:mainfrom
1winhyun:1winhyun
Open

[BE] ํ•œ์Šนํ˜„ ๐Ÿ‘ฅ ์˜ค๋Š˜์˜ ์ง๊ฟ์€?#22
1winhyun wants to merge 1 commit intoLeets-Official:mainfrom
1winhyun:1winhyun

Conversation

@1winhyun
Copy link
Member

๋ฏธ์…˜์‹คํ–‰๊ฒฐ๊ณผ

leets (2)

๊ธฐ๋Šฅ๋ช…์„ธ์„œ

  1. ๋ฉค๋ฒ„๋ฅผ ์ž…๋ ฅ๋ฐ›๊ณ  ','์„ ๊ธฐ์ค€์œผ๋กœ ๊ตฌ๋ณ„ํ•œ๋‹ค.
  2. ๋งŒ์•ฝ ์ž…๋ ฅ๋ฐ›์„ ๋•Œ ์˜์–ด๊ฐ€ ๋“ค์–ด๊ฐ€์žˆ๋‹ค๋ฉด ์˜ˆ์™ธ๋ฅผ ์ถœ๋ ฅํ•œ๋‹ค.
  3. ๋งŒ์•ฝ ์ž…๋ ฅํ•œ ๋ฉค๋ฒ„๋“ค์˜ ์ด ์ธ์›์ˆ˜๋ณด๋‹ค ์ž…๋ ฅํ•œ ๊ทธ๋ฃน ์ธ์›์ˆ˜๊ฐ€ ๋งŽ๋‹ค๋ฉด ์˜ˆ์™ธ ์ถœ๋ ฅํ•œ๋‹ค.
  4. ์ž…๋ ฅํ•œ ํ•œ ๊ทธ๋ฃน์˜ ์ธ์›์ˆ˜๋งŒํผ ๋žœ๋ค์œผ๋กœ ์ธ์›์„ ๋ฐฐ์น˜ํ•œ๋‹ค.
  5. ์žฌ์ถ”์ฒจ ์˜์‚ฌ๋ฅผ ๋ฌผ์–ด๋ด์„œ y๋ฅผ ์„ ํƒํ•  ๊ฒฝ์šฐ ์ธ์› ์„ž๋Š” ๊ฒƒ๋งŒ ๋‹ค์‹œ ํ•œ๋‹ค. n์„ ์„ ํƒํ•  ๊ฒฝ์šฐ ํ”„๋กœ๊ทธ๋žจ์„ ์ข…๋ฃŒํ•œ๋‹ค.

@1winhyun 1winhyun self-assigned this Apr 11, 2024
public void run() {
Scanner scanner=new Scanner(System.in);
try{
System.out.println("๋ˆ„๊ตฌ๋ˆ„๊ตฌ์žˆ์–ด?");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์š”๊ตฌ์‚ฌํ•ญ์— ๋งž๊ฒŒ ์ž‘์„ฑํ•ด์ฃผ์‹œ๋ฉด ๋” ์ข‹์„๊ฒƒ ๊ฐ™์•„์š”!

Comment on lines +26 to 43
while(true){
System.out.println("๋งˆ์Œ์— ์•ˆ๋“ค์–ด?(y/n)");
String answer=scanner.next();
if(answer.equalsIgnoreCase("y")){
leetsGroup=generateRandomGroups(membersList,groupNum);
printResult(leetsGroup);
}
else if(answer.equalsIgnoreCase("n")){
break;
}
}
}catch(IllegalArgumentException e){
System.out.println("[ERROR]"+ e.getMessage());
run();
}finally{
scanner.close();
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฉ”์„œ๋“œ๋กœ ๋”ฐ๋กœ ๋ถ„๋ฆฌํ•˜๋Š”๊ฒŒ ๋” ์ข‹์•„๋ณด์ž…๋‹ˆ๋‹ค

Comment on lines +79 to +81
for(int i=0;i<afterMembers.size();i+=maximumGroupSize){
groups.add(afterMembers.subList(i,Math.min(i+maximumGroupSize,afterMembers.size())));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด๋Ÿฐ ๋ฐฉ๋ฒ•๋„ ์žˆ๊ตฐ์š” ๋ฐฐ์›Œ๊ฐ‘๋‹ˆ๋‹ค

public List<String> parseMembers(String members) {
return new ArrayList<>();
List<String> memberList=new ArrayList<>();
String[] divide=members.split(",");
Copy link

@jj0526 jj0526 Apr 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์‚ฌ๋žŒ1, ์‚ฌ๋žŒ2, (๋„์–ด์“ฐ๊ธฐ 2๊ฐœ) ์‚ฌ๋žŒ3,์‚ฌ๋žŒ4, ์‚ฌ๋žŒ5
์ด๋ ‡๊ฒŒ ๋„์–ด์“ฐ๊ธฐ๊ฐ€ 0๊ฐœ, 1๊ฐœ, n๊ฐœ์ธ ๊ฒฝ์šฐ์—์„œ ์ด๋ฆ„๋งŒ ์ถœ๋ ฅ๋  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋ฉด ์ข‹์„๊ฑฐ๊ฐ™์•„์š”

Copy link
Member

@jiixon jiixon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋‹ค์Œ๋ฒˆ์—๋Š” ์ปค๋ฐ‹์ปจ๋ฒค์…˜๋„ ์‚ฌ์šฉํ•˜์—ฌ, ์ปค๋ฐ‹๋ฉ”์‹œ์ง€์—๋„ ์‹ ๊ฒฝ์“ฐ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”! ๋˜๋Š” ์—๋Ÿฌ๋ถ€๋ถ„์€ enum์œผ๋กœ ๋”ฐ๋กœ ExceptionํŒŒ์ผ์—์„œ ๊ด€๋ฆฌํ•ด๋„ ์ข‹์„๊ฒƒ ๊ฐ™์•„์š”

Comment on lines +26 to +36
while(true){
System.out.println("๋งˆ์Œ์— ์•ˆ๋“ค์–ด?(y/n)");
String answer=scanner.next();
if(answer.equalsIgnoreCase("y")){
leetsGroup=generateRandomGroups(membersList,groupNum);
printResult(leetsGroup);
}
else if(answer.equalsIgnoreCase("n")){
break;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์˜๋ฌธ y์™€ n ์ด์™ธ์˜ ๊ฐ’์ด ๋“ค์–ด์™”์„๋•Œ์˜ ์˜ˆ์™ธ์ฒ˜๋ฆฌ๊ฐ€ ์—†๋Š”๊ฒƒ ๊ฐ™์€๋ฐ, ์ข€๋” ๊ตฌ์ฒด์ ์ธ ์—๋Ÿฌ ๋กœ์ง์„ ์ถ”๊ฐ€ํ•˜๋Š”๊ฒŒ ์–ด๋–จ๊นŒ์š”?

String leetsMember=scanner.nextLine();
checkHasNoEnglish(leetsMember);

List<String> membersList=parseMembers((leetsMember));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(())๊ด„ํ˜ธ ์ค‘๋ณต ์žˆ๋Š”๊ฑฐ ๊ฐ™์•„์š”!

Comment on lines +27 to +28
System.out.println("๋งˆ์Œ์— ์•ˆ๋“ค์–ด?(y/n)");
String answer=scanner.next();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print("")ํ›„ nextLine()์„ ์ž…๋ ฅ๋ฐ›๋Š” ๊ฒƒ์ด ๊ฐ€๋…์„œ์ด ์ข€ ๋” ์ข‹์•„๋ณด์ž…๋‹ˆ๋‹ค!

Comment on lines +37 to +42
}catch(IllegalArgumentException e){
System.out.println("[ERROR]"+ e.getMessage());
run();
}finally{
scanner.close();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e๋กœ ๋„˜๊ฒจ์ฃผ๋Š” ๊ฒƒ๋ณด๋‹ค๋Š” ๊ตฌ์ฒด์ ์ธ ์ผ€์ด์Šค์— ๋”ฐ๋ผ์„œ ์—๋Ÿฌ๋ฉ”์‹œ์ง€๋ฅผ ๋„ฃ๋Š”๊ฒƒ์ด ์ข€๋” ์ข‹์„๊ฒƒ ๊ฐ™์•„์š”

Comment on lines +62 to +64
if(members.matches(".*[a-zA-Z].*")){
throw new IllegalArgumentException("์˜์–ด๊ฐ€ ๋“ค์–ด๊ฐ€๋ฉด ์•ˆ๋œ๋‹ค.");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋นˆ ๊ฐ’์ด ๋“ค์–ด๊ฐˆ ๊ฒฝ์šฐ๋„ ์ถ”๊ฐ€ํ•˜๋Š”๊ฒƒ์ด ์–ด๋–จ๊นŒ์š”?

Comment on lines +87 to +89
for(int i=0;i<result.size();i++){
System.out.println(result.get(i));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

["์ด๋ฆ„" | "์ด๋ฆ„"] ํ•ด๋‹น๊ณผ ๊ฐ™์€ ํ˜•ํƒœ๋กœ ์ถœ๋ ฅํ•ด์•ผํ•˜๋Š”๋ฐ, println์œผ๋กœ ์ถœ๋ ฅํ•˜๋ฉด ๋ฆฌ์ŠคํŠธ๋กœ ์ถœ๋ ฅ์ด ๋ ๊ฑฐ๊ฐ™์€๋ฐ, ์š”๊ตฌ์‚ฌํ•ญ์— ๋งž๊ฒŒ printํ•จ์ˆ˜๋ฅผ ๋‹ค์‹œ ๊ตฌ์„ฑํ•˜๋Š”๊ฒŒ ์–ด๋–จ๊นŒ์š”?

Comment on lines +76 to +78
List<String> afterMembers = new ArrayList<>(memberList);
Collections.shuffle(afterMembers);
List<List<String>> groups = new ArrayList<>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List๋ฅผ ์—ฌ๋Ÿฌ๋ฒˆ ์„ ์–ธํ•˜๋Š”๊ฒƒ๋ณด๋‹ค ๋ถˆํ•„์š”ํ•œ ์ฝ”๋“œ๋ฅผ ์ค„์ด๋Š”๊ฒŒ ์–ด๋–จ๊นŒ์š”? groups๋งŒ ์‚ฌ์šฉํ•˜๋ฉด ์ข€๋” ๊ฐ„๊ฒฐํ•œ ์ฝ”๋“œ๊ฐ€ ๋ ๊ฑฐ๊ฐ™์•„์š”!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants