Merged
Conversation
JooKangsan
approved these changes
Jan 3, 2025
Collaborator
There was a problem hiding this comment.
풀이 잘 봤습니다!! slice 메서드를 사용해서 풀어보시는 것도 좋을 것 같아요!
Collaborator
There was a problem hiding this comment.
이거는 push말고 다른 메서드들도 사용해 보시면 좋을 것 같아요!!
Comment on lines
+4
to
+6
| arr.forEach((el) => { | ||
| if(el % divisor === 0) answer.push(el); | ||
| }) |
Collaborator
There was a problem hiding this comment.
이거는 filter 를 사용해보는걸추천드려요!
Moonjonghoo
approved these changes
Jan 6, 2025
Collaborator
Moonjonghoo
left a comment
There was a problem hiding this comment.
강산님이 리뷰를 다해두셔서 메서드를 활용하는 풀이도 좋을거같아요!
bona1122
pushed a commit
to bona1122/AlgorithmStudy
that referenced
this pull request
Jan 9, 2025
* Slice array / 기초 * Length of array items / 기초 * Shift array / 기초 * Number of duplicated item / 기초 * Remove lowest number / 중급 * Sum of matrix / 중급 * Multiple number / 중급 * Chore: 폴더명 변경경
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
저는 뒤로 갈수록 모르는게 많아서 초반에 달렸습니다 ^ㅠ
오늘 알바때문에 문제를 미리 풀어뒀었어요!!!
[배열]
(3) 시간 복잡도
📌 푼 문제
배열 자르기 | https://school.programmers.co.kr/learn/courses/30/lessons/120833
배열 원소의 길이 | https://school.programmers.co.kr/learn/courses/30/lessons/120854
배열 회전시키기 | https://school.programmers.co.kr/learn/courses/30/lessons/120844
중복된 숫자 개수 | https://school.programmers.co.kr/learn/courses/30/lessons/120583
제일 작은 수 제거하기 | https://school.programmers.co.kr/learn/courses/30/lessons/12935
행렬의 덧셈 | https://school.programmers.co.kr/learn/courses/30/lessons/12950
나누어 떨어지는 숫자 배열 | https://school.programmers.co.kr/learn/courses/30/lessons/12910
📝 간단한 풀이 과정
1. 배열 자르기
인덱스 1부터 인덱스 2까지 반복문을 돌려 정답 배열에 넣었습니다.
2. 배열 원소의 길이
배열 0번째 요소부터 마지막 요소까지 반복문을 돌리고,
정답 배열에 각 요소 문자열의 길이를 담았습니다.
3. 배열 회전시키기
shift, unshift 메소드를 까먹어서 반복문을 이용해 구현했습니다.
4. 중복된 숫자 개수
filter 메소드를 사용하여 n과 같은 요소들의 배열을 만든 후, 해당 배열의 문자열의 길이를 저장하여 반환했습니다.
5. 제일 작은 수 제거하기
스프레드 문법을 활용하여 최소값을 찾은 후, 필터 메소드를 사용해 최소값이 아닌 원소들만 뽑아내어 반환했습니다.
6. 행렬의 덧셈
Array 생성자를 사용하여 배열을 초기화 한 후, 반복문을 사용하여 이차원 배열의 덧셈을 구현했습니다.
7. 나누어 떨어지는 숫자 배열
forEach 메소드를 사용하여 각각의 요소들에 대하여 나머지연산식 조건에 해당하는 경우 정답배열에 푸시되도록 했습니다.
이후 sort 메소드를 사용하여 오름차순 정렬했습니다.
compareFunction(a, b)이 0보다 큰 경우, b를 a보다 낮은 인덱스로 소트합니다.
참고 : https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/sort