diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5226356 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.py +*.json +*.csv \ No newline at end of file diff --git a/go/intersection-of-two-linked-lists.md b/go/intersection-of-two-linked-lists.md index 7d6b4d6..15886b9 100644 --- a/go/intersection-of-two-linked-lists.md +++ b/go/intersection-of-two-linked-lists.md @@ -92,8 +92,17 @@ func getIntersectionNode(headA, headB *ListNode) *ListNode { // Both pointers move through both lists for a != b { // When reaching the end of a list, switch to the head of the other list - a = if a == nil { headB } else { a.Next } - b = if b == nil { headA } else { b.Next } + if a == nil { + a = headB + } else { + a = a.Next + } + + if b == nil { + b = headA + } else { + b = b.Next + } } return a // or b, both are the intersection node or nil if no intersection diff --git a/python/min-cost-climbing-stairs.md b/python/min-cost-climbing-stairs.md index 48563d8..40380ad 100644 --- a/python/min-cost-climbing-stairs.md +++ b/python/min-cost-climbing-stairs.md @@ -73,7 +73,7 @@ Using dynamic programming, we fill an array with the minimum costs from the base ```python def minCostClimbingStairs(cost): n = len(cost) - dp = [0] * (n + 1) + dp = [0] * (n + 2) # Start calculating the minimum cost from the top to the base. for i in range(n - 1, -1, -1):