Merged
Conversation
JooKangsan
approved these changes
Jan 9, 2025
Collaborator
JooKangsan
left a comment
There was a problem hiding this comment.
수고하셨습니다!!. 파일은 본인 폴더 내에 작성부탁드려요...
문제도 코드리뷰어를 위해서 파일 별 분리 부탁드립니다...!
1주차는 제가 수정해서 올렸습니다!! 양해부탁드려요!
gramy159 폴더 내부에 작성 부탁드립니다!!!
bona1122
pushed a commit
to bona1122/AlgorithmStudy
that referenced
this pull request
Jan 9, 2025
* 25.1.2 - 1week.배열 * fix: 파일 수정 * remove: gitkeep 삭제 --------- Co-authored-by: RiverMountain <you04042@gmail.com>
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.
1Week. 배열
⏩푼 문제
기초
중급
☢️ 풀이과정
1. 배열 자르기
이 문제는 요구한대로 잘라야하므로, .slice() 매서드를 활용했음
매개변수: numbers= 자르려는 배열, num1= 추출구간의 시작 인덱스, num2= 추출구간의 종료 인덱스
핵심
=> 따라서, 자르는 종료구간을 num2+1로 지정하면 명시된 종료구간(num2)까지 추출됨
작성코드
2. 배열 원소의 길이
이 문제는 문자열의 길이를 계산해주는 .map() 매서드를 활용했음
매개변수: strlist = 문자열 배열
핵심
: strlist 배열의 문자열 길이 구하기를 수행한 새로운 배열을 반환함
: str은 strlist 배열의 각 요소들을 순회하며 문자열 길이인 length를 계산하여 새로운 배열의 요소로 추가
작성코드
3. 배열 회전시키기
이 문제는 회전방향이 2가지인 오른쪽&왼쪽의 경우를 모두 실행하기 위해 매개변수를 하나 정의하고, 맨 앞/뒤 요소 추가/제거 등을 실행할 수 있도록
.pop(), .unshfit(), .shift(), .push() 총 4가지 메서드를 활용했음
매개변수: numbers= 배열(회전시킬 대상), direction= 'right' 혹은 'left' 문자열의 값만 가짐(회전방향)
작성코드
4. 중복된 숫자 개수
이 문제는 같은 숫자의 개수를 세야하므로, 중복되는 숫자와 그 개수를 저장할 매개변수 2개를 정의하고, for문을 사용하여 문제의 배열을 순회하면서 if문을 사용해 중복숫자의 개수를 셀 수 있게 작성했음 / 따로 활용할 메서드가 없어보였음
매개변수: array = 정수 배열, n = 중복되는 특정 숫자
작성코드
5. 제일 작은 수 제거하기
이 문제는 배열에서 가장 작은 값을 찾아 제거하고 새로운 배열을 반환해야함
매개변수: arr = 배열
핵심
: 숫자 중 최소값 반환
: 주어진 조건을 만족하는 요소만 모아 새로운 배열 반환
작성코드
코딩테스트를 처음으로 본격적으로 풀다보니, 기초에서부터 시간이 꽤나 오래걸렸습니다.. 코드를 알고보면 쉬운 문제들도 있었고, 아직 모르는 매서드가 많아 문제에서 요구한 니즈에 맞는 매서드를 찾는데도 시간이 소요됐던 것 같아요.
원래 목표는 기초2,초급2,중급1 였으나, 제 현상태를 자각하고 천천히 실력을 늘릴 계획입니다. 많은 리뷰 남겨주십쇼
저번주 긴 일정으로 차질이 생겨 늦게 제출해 죄송합니다. 다음주부터 제때 올리겠습니다!