Skip to content

[BE] ๊น€์˜ˆ์ฐฌ ๐Ÿ‘ฅ ์˜ค๋Š˜์˜ ์ง๊ฟ์€?#14

Open
yechan-kim wants to merge 5 commits into
Leets-Official:mainfrom
yechan-kim:yechan-kim
Open

[BE] ๊น€์˜ˆ์ฐฌ ๐Ÿ‘ฅ ์˜ค๋Š˜์˜ ์ง๊ฟ์€?#14
yechan-kim wants to merge 5 commits into
Leets-Official:mainfrom
yechan-kim:yechan-kim

Conversation

@yechan-kim

Copy link
Copy Markdown
Member

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

[ํ…Œ์ŠคํŠธ ์‹คํ–‰ ํ„ฐ๋ฏธ๋„ ์บก์ณ ์ด๋ฏธ์ง€ ํŒŒ์ผ ์ฒจ๋ถ€]
[ํ…Œ์ŠคํŠธ]
image

image

[์‹คํ–‰๊ฒฐ๊ณผ]
image

๋ฏธ์…˜ ์‹คํ–‰ ์‹คํŒจ ์ผ€์ด์Šค ์กด์žฌ ์‹œ, ์‹คํŒจํ•œ ์ด์œ  ๊ณ ์ฐฐํ•ด๋ณด๊ธฐ

์ •์ƒ ์ž‘๋™

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

  1. String์œผ๋กœ ์ด๋ฆ„์„ ์ž…๋ ฅ๋ฐ›์•„ [parseMembers] ๋ฉ”์„œ๋“œ์—์„œ ','๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ด๋ฆ„ ๋ฆฌ์ŠคํŠธ ์ƒ์„ฑ
  2. [memberNumber] ๋ฉ”์„œ๋“œ์—์„œ ์ž…๋ ฅ๋œ ์ด๋ฆ„์ˆ˜๋ฅผ ์ €์žฅ
  3. [parseMembers] ๋ฉ”์„œ๋“œ์—์„œ [checkHasNoEnglish] ๋ฉ”์„œ๋“œ๋ฅผ ํ†ตํ•ด ์ด๋ฆ„ ์ค‘์— ์˜์–ด๊ฐ€ ์—†๋„๋ก ์˜ˆ์™ธ ์ฒ˜๋ฆฌ
  4. ์ตœ๋Œ€ ์ง ์ˆ˜๋ฅผ ์ž…๋ ฅํ•˜๊ณ , [checkMaxGroup]๋ฅผ ํ†ตํ•ด ์ตœ๋Œ€ ์ง ์ˆ˜๊ฐ€ ์ž…๋ ฅ๋œ ์ด๋ฆ„ ์ˆ˜๋ณด๋‹ค ๋งŽ์ง€ ์•Š๊ฒŒ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ
  5. [generateRandomGroups] ๋ฉ”์„œ๋“œ์—์„œ ๊ทธ๋ฃน๋ณ„ ๋ฆฌ์ŠคํŠธ ์ƒ์„ฑ
  6. [printResult] ๋ฉ”์„œ๋“œ์—์„œ ์ „์ฒด ๊ทธ๋ฃน ์ถœ๋ ฅ
  7. [ask] ๋ฉ”์„œ๋“œ์—์„œ ์žฌ๊ตฌ์„ฑ ์—ฌ๋ถ€๋ฅผ ์ž…๋ ฅ๋ฐ›๊ณ , y/n ์ด์™ธ์˜ ์ž…๋ ฅ์„ ๋ฐ›์ง€ ์•Š๋„๋ก ์˜ˆ์™ธ ์ฒ˜๋ฆฌ
  8. ๋ฐ˜๋ณต๋ฌธ์„ ํ†ตํ•ด ์žฌ์‹คํ–‰ ๊ธฐ๋Šฅ ๊ตฌํ˜„

@taeseokyang taeseokyang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

๋กœ์ง์„ ์ž‘์„ฑํ•œ ํ›„, GPT์—๊ฒŒ ๊ฐœ์„ ์„ ์š”์ฒญ ํ•ด๋ณด์‹œ๋Š”๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค! GPT๋Š” ์ข‹์€ ์ฝ”๋“œ๋ฆฌ๋ทฐ์–ด์ด๊ณ , ๊ฐœ์„  ๊ฒฐ๊ณผ์—์„œ ๋ฐฐ์šฐ๋Š” ๊ฒƒ์ด ๋งŽ์Šต๋‹ˆ๋‹ค.

๋žœ๋ค ๊ทธ๋ฃน ๋งค์นญ ํ•จ์ˆ˜ ๋กœ์ง์„ ๊ฐœ์„  ํ•ด๋ณด์‹œ๋Š” ๊ฑธ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค!!

์ˆ˜๊ณ ํ•˜์…จ์Šต๋‹ˆ๋‹ค!

System.out.println("[Leets ์˜ค๋Š˜์˜ ์ง์—๊ฒŒ]๋ฅผ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.");

System.out.println("\n์ฐธ์„์ž๋“ค์˜ ์ด๋ฆ„์„ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”. (,๋กœ ๊ตฌ๋ถ„)");
String inputStr = sc.nextLine();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

์–ด๋–ค ์ž…๋ ฅ์ธ์ง€ ์•Œ ์ˆ˜ ์žˆ๋Š” ๋ณ€์ˆ˜๋ช…์ด๋ฉด ๋”์šฑ ์ข‹์„๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค!

memberNamesInput ๋Š” ์–ด๋–จ๊นŒ์š”?

checkDataValidity(memberNumber(members), maximumGroupSize);
System.out.println();

boolean result = true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

๋ณ€์ˆ˜๋ช…์ด ์ ์ ˆํ•˜์ง€ ์•Š์€ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค! ๊ฒฐ๊ณผ๊ฐ€ ๊ฑฐ์ง“, ์ง„์‹ค์€ ์•„๋‹ˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

isDone ๊ฐ™์€ ๋ณ€์ˆ˜๋Š” ์–ด๋–ค๊ฐ€์š”? booleanํ˜• ๋ณ€์ˆ˜๋Š” ์•ž์— is๋ฅผ ๋ถ™์ด๋ฉด ์ฝ๊ธฐ ์‰ฝ์Šต๋‹ˆ๋‹ค!

@ay-eonii ay-eonii left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

1์ฃผ์ฐจ ๋ฏธ์…˜ ๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค๐Ÿฅณ
์š”๊ตฌ์‚ฌํ•ญ์„ ๋„ˆ๋ฌด ์ž˜ ์ง€์ผœ์ฃผ์…จ๋„ค์š”!

Scanner sc = new Scanner(System.in);
System.out.println("[Leets ์˜ค๋Š˜์˜ ์ง์—๊ฒŒ]๋ฅผ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.");

System.out.println("\n์ฐธ์„์ž๋“ค์˜ ์ด๋ฆ„์„ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”. (,๋กœ ๊ตฌ๋ถ„)");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

๊ฐœํ–‰๋ฌธ์ž๋ฅผ \n๋กœ ๋‘์—ˆ์„ ๋•Œ ์–ด๋–ค ๋ฌธ์ œ๊ฐ€ ์žˆ์„๊นŒ์š”?

}

// ๋‹ค์‹œ ์ถ”์ฒœ์„ ํ• ์ง€ ๋ฌผ์–ด๋ณด๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.
public boolean ask(String operator) throws Exception {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ask์—๋Š” ์žฌ์ถ”์ฒจ ์—ฌ๋ถ€๋ผ๋Š” ์˜๋ฏธ๊ฐ€ ์ž˜ ๋‹ด๊ฒจ์žˆ์ง€ ์•Š์€ ๊ฒƒ ๊ฐ™์•„์š” ๐Ÿฅฒ

Collections.shuffle(memberList);

List<List<String>> result = new ArrayList<>();
List<String> temp = new ArrayList<>();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

์กฐ๊ธˆ๋” ์˜๋ฏธ๋ฅผ ๋‹ด์•„ ๋ณ€์ˆ˜๋ช…์„ ๋งŒ๋“ค์–ด์ฃผ์‹œ๋ฉด ๋‹ค๋ฅธ ์‚ฌ๋žŒ์ด ์ฝ”๋“œ ์ฝ์„ ๋•Œ ์ดํ•ด๊ฐ€ ์‰ฌ์šธ ๊ฒƒ ๊ฐ™์•„์š”๐Ÿ˜„

Comment on lines +93 to +101
for (List<String> group : result) {
sb.append("[");

for (int i = 0; i < group.size() - 1; i++) {
sb.append(" ").append(group.get(i)).append(" |");
}

sb.append(" ").append(group.get(group.size() - 1)).append(" ]\n");
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

StringJoiner์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์‹œ๋ฉด ๋„์›€์ด ๋  ๊ฒƒ ๊ฐ™์•„์š” ๐Ÿ˜Š

Comment on lines +111 to +114
else if (operator.equals("y")){
System.out.println("--------------------------------");
return true;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

early return ํŒจํ„ด์ด๋ผ๋ฉด else๊ฐ€ ํ•„์š”์—†์–ด ๋ณด์ด๋„ค์š”๐Ÿ˜Š

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.

3 participants