-
Notifications
You must be signed in to change notification settings - Fork 0
이주성 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zusung47
wants to merge
13
commits into
main
Choose a base branch
from
homework_jusung
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
이주성 #1
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
55adb73
연습
ccbde76
[짝수와 홀수]
ccec909
[평균 구하기]
8bda464
[자릿수 더하기]
d4c6fe0
[자릿수 더하기]
a9b6bac
[자릿수 더하기]
6a89016
[문자열 내 p와 y의 개수]
c7163ec
[나머지 1이 되는 수 찾기]
dac252a
[문자열 다루기 기본]
7c8f348
[문자열내 p와 y의 개수]
cb47baf
[하샤드 수]
a314e82
[서울에서 김서방 찾기]
94d0b12
[콜라츠 추측]
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package org.example; | ||
|
|
||
| class solution2 { | ||
| public double solution(int[] arr) { | ||
| double answer = 0; | ||
| for(int i = 0; i<arr.length; i++){ | ||
| answer = answer + (double)arr[i]; | ||
| } | ||
| answer = answer/(double)arr.length; | ||
| return answer; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package org.example; | ||
|
|
||
| public class solution3 { | ||
| public int solution(int n) { | ||
| int answer = 0; | ||
| String str = Integer.toString(n); | ||
| for(char x : str.toCharArray()){ | ||
| int a = x - 48; | ||
| answer = answer + a; | ||
| } | ||
| return answer; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Integer.toString 배우고 갑니다 굿 |
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package org.example; | ||
|
|
||
| public class solution4 { | ||
| boolean solution(String s) { | ||
| boolean answer = true; | ||
| int p = 0; | ||
| int y = 0; | ||
| for (int i = 0; i < s.length(); i++) { | ||
| if (s.charAt(i) == 'p' || s.charAt(i) == 'P') { | ||
| p++; | ||
| } else if (s.charAt(i) == 'y' || s.charAt(i) == 'Y') { | ||
| y++; | ||
| } | ||
| } | ||
| if (p != y) { | ||
| answer = false; | ||
| } | ||
| return answer; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package org.example; | ||
|
|
||
| public class solution5 { | ||
| public int solution(int n) { | ||
| int answer = 0; | ||
| for(int i = 1; i<n; i++){ | ||
| if(n%i == 1){ | ||
| answer = i; | ||
| break; | ||
| } | ||
| } | ||
| return answer; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package org.example; | ||
|
|
||
| public class solution6 { | ||
| public boolean solution(String s) { | ||
| boolean answer = true; | ||
| char [] arr = s.toCharArray(); | ||
|
|
||
| if(arr.length!=4 && arr.length!=6){ | ||
| return false; | ||
| } | ||
| for(int i = 0; i<arr.length; i++){ | ||
| if(arr[i]<'0' || arr[i]>'9'){ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 문자 직접 비교하는 방법 좋네요👍👍 |
||
| return false; | ||
| } | ||
| } | ||
| return answer; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package org.example; | ||
|
|
||
| public class solution7 { | ||
| public boolean solution(int x) { | ||
| boolean answer = false; | ||
| int y = x/10000 + x%10000/1000 + x%10000%1000/100 + x%10000%1000%100/10 +x%10000%1000%100%10/1; | ||
| if(x%y==0) answer = true; | ||
| return answer; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package org.example; | ||
|
|
||
| import java.util.*; | ||
|
|
||
| class solution8 { | ||
| public String solution(String[] seoul) { | ||
| String answer = ""; | ||
| StringBuilder sb = new StringBuilder(); | ||
| int x = 0; | ||
| for(int i = 0; i<seoul.length; i++){ | ||
| if("Kim".equals(seoul[i])){ | ||
| x = i; | ||
| } | ||
| } | ||
| sb.append("김서방은 "); | ||
| sb.append(Integer.toString(x)); | ||
| sb.append("에 있다"); | ||
| answer = sb.toString(); | ||
| return answer; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package org.example; | ||
|
|
||
| public class solution9 { | ||
| //매개변수의 자료형이 int이면 오버플로우 발생으로 자료형을 long으로 바꿔줘야함 | ||
| public int solution(long num) { | ||
| int answer = 0; | ||
| while(num != 1){ | ||
| answer++; | ||
| if(answer==500){ | ||
| answer = -1; | ||
| break; | ||
| } | ||
| num = num % 2 == 0 ? num / 2 : num * 3 + 1; | ||
| } | ||
| return answer; | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
멋있어요 😍