-
Notifications
You must be signed in to change notification settings - Fork 4
[jiyeeeah] 25.01.03 #9
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d549d24
배열 자르기 / 기초
jiyeeeah 810cd77
배열 원소의 길이 / 기초
jiyeeeah 1f0eaf7
배열 회전시키기 / 기초
jiyeeeah 276611b
중복된 숫자 개수 / 기초
jiyeeeah 7f2ee4a
제일 작은 수 제거하기 / 중급
jiyeeeah b94f4f2
행렬의 덧셈 / 중급
jiyeeeah a184ff6
나누어 떨어지는 숫자 배열 / 중급
jiyeeeah 50691f6
행렬의 곱셈 / 심화
jiyeeeah 13ae4bb
배열 배운 것 정리 파일
jiyeeeah 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,7 @@ | ||
| function solution(strlist) { | ||
| const answer = []; | ||
| for (const str of strlist) { | ||
| answer.push(str.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,9 @@ | ||
| function solution(arr, divisor) { | ||
| const answer = []; | ||
| for (const val of arr) { | ||
| if (val % divisor === 0) answer.push(val); | ||
| } | ||
| if (answer.length <= 0) answer.push(-1); | ||
| answer.sort((a, b) => a - b); | ||
| 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,3 @@ | ||
| function solution(array, n) { | ||
| return array.filter((value) => value === n).length; | ||
| } |
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 @@ | ||
| function solution(arr1, arr2) { | ||
| const r1 = arr1.length; | ||
| const c1 = arr1[0].length; | ||
| const r2 = arr2.length; | ||
| const c2 = arr2[0].length; | ||
| // c1 === r2임 | ||
|
|
||
| const answer = new Array(r1).fill(0).map(() => new Array(c2).fill(0)); | ||
|
|
||
| for (let i = 0; i < r1; i++) { | ||
| for (let j = 0; j < c2; j++) { | ||
| for (let k = 0; k < c1; k++) { | ||
| answer[i][j] += arr1[i][k] * arr2[k][j]; | ||
| } | ||
| } | ||
| } | ||
| 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,11 @@ | ||
| function solution(arr1, arr2) { | ||
| const Xn = arr1.length; | ||
| const Yn = arr1[0].length; | ||
| const answer = new Array(Xn).fill(0).map(() => new Array(Yn).fill(0)); | ||
| for (let i = 0; i < Xn; i++) { | ||
| for (let j = 0; j < Yn; j++) { | ||
| answer[i][j] = arr1[i][j] + arr2[i][j]; | ||
| } | ||
| } | ||
| return answer; | ||
| } |
|
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. 정렬은 안해도 괜찮을것 같아요!! 이거는
Collaborator
Author
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. 오오 그렇네요!! 감사합니다 👍 |
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,9 @@ | ||
| function solution(arr) { | ||
| const answer = [...arr]; | ||
|
|
||
| const minNum = arr.sort((a, b) => a - b)[0]; | ||
| answer.splice(answer.indexOf(minNum), 1); | ||
| if (answer.length <= 0) answer.push(-1); | ||
|
|
||
| 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,11 @@ | ||
| function solution(numbers, direction) { | ||
| const answer = [...numbers]; | ||
| if (direction === "right") { | ||
| const temp = answer.pop(); | ||
| answer.unshift(temp); | ||
| } else if (direction === "left") { | ||
| const temp = answer.shift(); | ||
| answer.push(temp); | ||
| } | ||
| 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,4 @@ | ||
| function solution(numbers, num1, num2) { | ||
| const answer = numbers; | ||
| return answer.slice(num1, num2 + 1); | ||
| } |
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,24 @@ | ||
| > 이번에는 문제를 풀며 몰랐거나 까먹었다가 이제 다시 알게 된 부분들 위주로 정리해봤습니다. | ||
|
|
||
| ## 2차원 배열 만들기 | ||
|
|
||
| ```js | ||
| const arr = new Array(5).fill(0).map(() => new Array(4)); | ||
| ``` | ||
|
|
||
| ### 📄 REFERENCE | ||
|
|
||
| https://joonfluence.tistory.com/508 | ||
|
|
||
| ## 행렬의 곱셈 | ||
|
|
||
| ```js | ||
| const r1 = arr1.length; | ||
| const c1 = arr1[0].length; | ||
| const r2 = arr2.length; | ||
| const c2 = arr2[0].length; | ||
| // 여기서 c1 === r2이다. | ||
|
|
||
| // 결과 배열은 r1 * c2이다. | ||
| const answer = new Array(r1).fill(0).map(() => new Array(c2).fill(0)); | ||
| ``` |
Oops, something went wrong.
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.
map을 사용해서 좀 더 간결하게 풀 수 있어요!
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.
그렇네요 ㅎㅎ 좋은 의견 감사합니다! 👍 😄