Skip to content

[grapefruitgreentealoe] WEEK 01 solutions #1130

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 10 commits into from
Apr 6, 2025

Conversation

grapefruitgreentealoe
Copy link
Contributor

@grapefruitgreentealoe grapefruitgreentealoe commented Mar 30, 2025

답안 제출 문제

작성자 체크 리스트

  • 우측 메뉴에서 PR을 Projects에 추가해주세요.
  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

var containsDuplicate = function (nums) {
const numberSet = new Set();
//시간 복잡도 O(n)
for (i of nums) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요! 첫 리뷰 남겨봅니다!

i 변수가 let, const로 선언되어 있지 않아 JS에서 자동으로 전역 변수로 취급되어 글로벌 스코프 오염 문제가 발생할 수 있을 것 같습니다.
지금처럼 단순한 로직에서는 큰 문제가 없어 보이지만, 복잡한 코드에서는 신경 써야 할 것 같습니다~!

Copy link
Contributor

@jiji-hoon96 jiji-hoon96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다양한 방법으로 올려주셔서 좋았습니다 굿굿!!

Comment on lines +13 to +20
var twoSum = function (nums, target) {
//순회. target에서 nums[i]를 뺀 요소를 찾기.
//2중포문. 시간복잡도 O(1)~O(N^2)
for (let i = 0; i < nums.length; i++) {
const subNum = target - nums[i]; // 공간 O(1)
for (let j = i + 1; j < nums.length; j++) {
if (nums[j] == subNum) {
return [i, j];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

역시 시작은 다 이렇게..ㅋㅋ (저만 그런게 아니였네요)

@grapefruitgreentealoe grapefruitgreentealoe moved this from Solving to In Review in 리트코드 스터디 4기 Apr 4, 2025
@jiji-hoon96 jiji-hoon96 self-requested a review April 6, 2025 02:42
Copy link
Contributor

@jiji-hoon96 jiji-hoon96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!!

@jiji-hoon96 jiji-hoon96 moved this from In Review to Completed in 리트코드 스터디 4기 Apr 6, 2025
@grapefruitgreentealoe
Copy link
Contributor Author

고생하셨습니다!!

1주차 고생많으셨습니다! 이번주도 화이팅입니다~

@grapefruitgreentealoe grapefruitgreentealoe merged commit 0550d01 into DaleStudy:main Apr 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

2 participants