This repository was archived by the owner on Aug 21, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
박성훈 / 주중8A / 20회차 #431
Open
hun0613
wants to merge
3
commits into
devyuriii:주중8A
Choose a base branch
from
hun0613:주중8
base: 주중8A
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.
The head ref may contain hidden characters: "\uC8FC\uC9118"
Open
박성훈 / 주중8A / 20회차 #431
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // 테스트 1 〉 통과 (0.17ms, 33.5MB) | ||
| // 테스트 2 〉 통과 (0.07ms, 33.5MB) | ||
| // 테스트 3 〉 통과 (0.16ms, 33.5MB) | ||
| // 테스트 4 〉 통과 (0.14ms, 33.4MB) | ||
| // 테스트 5 〉 통과 (0.17ms, 33.4MB) | ||
| // 테스트 6 〉 통과 (43.75ms, 41.2MB) | ||
| // 테스트 7 〉 통과 (43.78ms, 39.6MB) | ||
| // 테스트 8 〉 통과 (3.66ms, 36.1MB) | ||
| // 테스트 9 〉 통과 (44.76ms, 38.7MB) | ||
| // 테스트 10 〉 통과 (14.93ms, 40MB) | ||
| // 테스트 11 〉 통과 (292.03ms, 96.5MB) | ||
| // 테스트 12 〉 통과 (253.12ms, 96.5MB) | ||
| // 테스트 13 〉 통과 (257.15ms, 96MB) | ||
| // 테스트 14 〉 통과 (295.08ms, 95.8MB) | ||
| // 테스트 15 〉 통과 (258.29ms, 97.4MB) | ||
| // 테스트 16 〉 통과 (0.06ms, 33.4MB) | ||
| // 테스트 17 〉 통과 (0.10ms, 33.6MB) | ||
| // 테스트 18 〉 통과 (0.26ms, 33.4MB) | ||
| // 테스트 19 〉 통과 (0.25ms, 33.5MB) | ||
| // 테스트 20 〉 통과 (0.39ms, 33.4MB) | ||
| // 테스트 21 〉 통과 (0.10ms, 33.5MB) | ||
| // 테스트 22 〉 통과 (0.10ms, 33.5MB) | ||
| // 테스트 23 〉 통과 (0.10ms, 33.6MB) | ||
| // 테스트 24 〉 통과 (0.11ms, 33.4MB) | ||
|
|
||
| function solution(k, m, score) { | ||
| //m : 한 상자에 담는 사과 수 | ||
| //k : 사과의 최고점수 | ||
| //score : 사과 점수 | ||
|
|
||
| // 사과 한상자의 가격 : 최저점 * m | ||
|
|
||
| let answer = 0; | ||
| let sortedScore = score.sort((a,b)=>a-b); | ||
|
|
||
| while(sortedScore.length >= m){ | ||
| let box = []; | ||
| for (let i = 0; i < m; i++){ | ||
| box.push(sortedScore.pop()); | ||
|
Collaborator
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. push가 O(n)이어서 여기서 바로 더하는 방법을 이용하시면 시간복잡도를 더 줄일 수 있을 것 같아요! |
||
| } | ||
| answer += (Math.min(...box) * m); | ||
| } | ||
| 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,52 @@ | ||
| // 테스트 1 〉 통과 (1.13ms, 35.6MB) | ||
| // 테스트 2 〉 통과 (1.26ms, 35.6MB) | ||
| // 테스트 3 〉 통과 (0.31ms, 33.6MB) | ||
| // 테스트 4 〉 통과 (0.42ms, 33.6MB) | ||
| // 테스트 5 〉 통과 (2.23ms, 35MB) | ||
| // 테스트 6 〉 통과 (3.35ms, 35.6MB) | ||
| // 테스트 7 〉 통과 (0.31ms, 32.7MB) | ||
| // 테스트 8 〉 통과 (6.32ms, 35.8MB) | ||
| // 테스트 9 〉 통과 (0.45ms, 33.5MB) | ||
| // 테스트 10 〉 통과 (4.68ms, 35.9MB) | ||
| // 테스트 11 〉 통과 (0.23ms, 33.6MB) | ||
| // 테스트 12 〉 통과 (0.17ms, 33.4MB) | ||
| // 테스트 13 〉 통과 (0.25ms, 33.4MB) | ||
| // 테스트 14 〉 통과 (0.21ms, 33.5MB) | ||
| // 테스트 15 〉 통과 (0.23ms, 33.4MB) | ||
| // 테스트 16 〉 통과 (4.50ms, 35.9MB) | ||
| // 테스트 17 〉 통과 (4.38ms, 35.5MB) | ||
| // 테스트 18 〉 통과 (0.21ms, 33.5MB) | ||
| // 테스트 19 〉 통과 (0.08ms, 33.5MB) | ||
| // 테스트 20 〉 통과 (6.26ms, 35.9MB) | ||
| // 테스트 21 〉 통과 (4.35ms, 35.9MB) | ||
| // 테스트 22 〉 통과 (0.47ms, 33.6MB) | ||
| // 테스트 23 〉 통과 (0.07ms, 33.4MB) | ||
| // 테스트 24 〉 통과 (6.91ms, 36.1MB) | ||
| // 테스트 25 〉 통과 (5.11ms, 35.8MB) | ||
| // 테스트 26 〉 통과 (0.06ms, 33.5MB) | ||
|
|
||
| function solution(nums) { | ||
| let count = 0; | ||
|
|
||
| for (let i = 0; i < nums.length - 2; i++){ | ||
|
Collaborator
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. 3중 for문 채용할 수 밖에.. |
||
| for (let j= i+1; j < nums.length - 1; j++){ | ||
| for (let k = j+1; k < nums.length; k++){ | ||
| if (isDecimal(nums[i] + nums[j] + nums[k])){ | ||
| count++; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return count; | ||
| } | ||
|
|
||
| function isDecimal(num){ | ||
| for (let i = 2; i <= Math.sqrt(num); i++){ | ||
| if (num % i === 0){ | ||
| return false; | ||
| break; | ||
| } | ||
| } | ||
| return true; | ||
| } | ||
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,27 @@ | ||
| // 테스트 1 〉 통과 (0.04ms, 33.5MB) | ||
| // 테스트 2 〉 통과 (0.04ms, 33.4MB) | ||
| // 테스트 3 〉 통과 (0.05ms, 33.5MB) | ||
| // 테스트 4 〉 통과 (0.07ms, 33.4MB) | ||
| // 테스트 5 〉 통과 (0.06ms, 33.4MB) | ||
| // 테스트 6 〉 통과 (0.05ms, 33.5MB) | ||
| // 테스트 7 〉 통과 (0.34ms, 33.5MB) | ||
| // 테스트 8 〉 통과 (0.33ms, 33.4MB) | ||
| // 테스트 9 〉 통과 (0.21ms, 32.7MB) | ||
| // 테스트 10 〉 통과 (0.33ms, 32.8MB) | ||
| // 테스트 11 〉 통과 (0.15ms, 33.5MB) | ||
| // 테스트 12 〉 통과 (0.24ms, 33.4MB) | ||
| // 테스트 13 〉 통과 (3.13ms, 37.3MB) | ||
| // 테스트 14 〉 통과 (2.94ms, 37.3MB) | ||
|
|
||
| function solution(n) { | ||
| let fibo = Array(n+1).fill(0); | ||
|
|
||
| fibo[0] = 0; | ||
| fibo[1] = 1; | ||
|
|
||
| for(let i = 2; i <= n; i++){ | ||
| fibo[i] = (fibo[i-2] + fibo[i-1]) % 1234567; | ||
| } | ||
|
|
||
| return fibo.pop(); | ||
|
Collaborator
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. pop을 사랑하시는 성훈님 |
||
| } | ||
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.
옹 while문을 사용하셨군요