Skip to content

Conversation

@lee-JunR
Copy link
Owner

@lee-JunR lee-JunR commented Jun 3, 2024

240604 이준렬 0x05 풀이

Copy link
Contributor

Choose a reason for hiding this comment

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

저는 if문을 사용하긴 했는데, 확실히 제어하는 구문이 많을 수록 switch를 사용하는 것이 깔끔하긴 하네요!

Copy link
Owner Author

Choose a reason for hiding this comment

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

사실 이번 문제 파이썬으로 이전에 풀었을 때는 'p' 같이 제알 앞 한 문자만 비교했었거든요.. 자바도 그렇게 진행할 것 그랬네요!

Copy link
Contributor

Choose a reason for hiding this comment

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

전 합을 구할 때 for을 활용해서 구했는데, while로 스택이 빌 때까지 반복해서 구하셨네요!
출력할때도, 전 springbuilder를 활용했는데, 준렬님 코드를 보니까 굳이 그렇게 까지 할 필요는 없던
것 같네요.. 다음에 문제 풀 때는 더 고려해봐야겠어요

@growingJd
Copy link
Contributor

1시 커밋이라니.. 늦은시간 까지 고생 많으셨습니다..

Copy link
Contributor

Choose a reason for hiding this comment

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

저는 sb에 추가할 때, sb.append("+\n");
이렇게 한번에 추가했는데 혹시 따로 추가하신 이유가 있으실까요???

Copy link
Owner Author

Choose a reason for hiding this comment

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

핫 그렇게 푸는게 훨씬 좋겠네요! 생각이 닫혀있었어요!

Copy link
Contributor

Choose a reason for hiding this comment

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

저랑 전체적으로 같은데 이부분만 반대네요 ㅎㅎ
이번에 문제 풀 때 저랑 같은 생각이 같았나봐요

Copy link
Contributor

Choose a reason for hiding this comment

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

mapToInt라는 함수랑 Stream관련 함수들을 잘 사용해보지 않았는데 뭔가 되게 멋있고 간편해보여요..
저도 다음에 기회가 있으면 참고해볼게요 배워갑니다!

Copy link
Owner Author

Choose a reason for hiding this comment

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

저도 다른분들 코드를 보고 살짜쿠 저장해뒀다가 사용한거랍니다...ㅎ 이렇게 야금야금 여러분들의 좋은 코드를 모아두는게 또 스터디의 이점인 것 같아요!

Copy link
Contributor

Choose a reason for hiding this comment

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

문제 그대로 우측 끝부터 좌측 방향으로 문제를 해결하셨네요!
전 먼저 데이터를 한 번에 저장할 생각을 못했어서, 입력과 동시에 값을 비교하는 방식으로 해결했는데,
이렇게 구하면 정말 문제 의도대로 간편하게 해결 가능하겠네요! 배워갑니다!!

Copy link
Contributor

Choose a reason for hiding this comment

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

저는 값을 받으면서 바로 비교하는 느낌으로 해결했는데,
먼저 값을 다 받고 구하면 확실히 코드가 깔끔하긴 하네요!

Copy link
Owner Author

Choose a reason for hiding this comment

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

상황에 따라 다른 것 같아요! 저번주에 같은 리뷰를 올리긴 했는데 TC가 많을때나 한번 돌릴때마다 값을 바로바로 처리해야하는 경우에는 받으면서 바로 비교하는 것도 좋을 것 같아요!

Copy link
Contributor

Choose a reason for hiding this comment

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

전 2493번 탑 문제처럼, 문제에 해당하는 값들을 따로 배열화한 후, 저장하는 느낌으로 구현했는데,
이렇게 바로 더하면 더 깔끔하고 최적화하여 해결할 수 있겠네요. 생각 못했습니다..

Copy link
Owner Author

Choose a reason for hiding this comment

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

저는 처음 풀때 stack의 idx 를 비교해서 구하는 식으로 했는데 size() 를 사용하면 훨씬 간편하게 비교가 가능하더라구요...
간만에 벽 쪼금 느꼈습니다!

@lee-JunR lee-JunR merged commit aaf4cc4 into main Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants