단순연결리스트(2)
-
[LeetCode] 2. Add Two Numbers
LeetCode 2. Add Two Numbers https://leetcode.com/problems/add-two-numbers/ Add Two Numbers - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Solution # Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Sol..
2021.01.14 -
[자료구조] Single Linked List (단순 연결 리스트) 구현
Single Linked List (단순 연결 리스트) 파이썬으로 구현 해 보았다. # Single Linked List class Node: def __init__(self, item, next=None): self.item = item self.next = next class SingleLinkedList: def __init__(self): self.head = None self.size = 0 def list_size(self): return self.size def is_empty(self): if self.size != 0: return False else: return True def select_node(self, idx): if idx >= self.size: print("Index Er..
2021.01.11