Skip to content

[haung921209] Week 7 solutions #1471

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions reverse-linked-list/haung921209.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 연관 링크
- [문제 풀이 스케줄](https://github.com/orgs/DaleStudy/projects/6/views/5)
- [답안 코드 제출법](https://github.com/DaleStudy/leetcode-study/wiki/%EB%8B%B5%EC%95%88-%EC%A0%9C%EC%B6%9C-%EA%B0%80%EC%9D%B4%EB%93%9C)

# Problem
- 문제 링크 : https://leetcode.com/problems/reverse-linked-list/description/
- 문제 이름 : reverse-linked-list
- 문제 번호 : 206
- 난이도 : easy
- 카테고리 :

# 아이디어
- 어떤 방법으로 접근했는지 서술
- 포스 vs 최적화 아이디어 차이 등
- 잡도에 대한 고려

# ✅ 코드 (Solution)

```cpp
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* reverseListSubFunc(ListNode* before, ListNode* after){
if(!after){
return before;
}

auto next = after->next;
after->next = before;
return reverseListSubFunc(after, next);
}

ListNode* reverseList(ListNode* head) {
return reverseListSubFunc(nullptr, head);
}
};
```


# 🔍 코드 설명


# 최적화 포인트 (Optimality Discussion)
• 최적화한 이유와 원리
• 더 줄일 수 있는 여지는 있는가?
• 기존 방법 대비 얼마나 효율적이었는지

# 🧪 테스트 & 엣지 케이스

# 📚 관련 지식 복습

# 🔁 회고