Removing old questions

Removed questions uploaded using an old version of LeetHub
Questions 2,3,4,19,36,141,206
This commit is contained in:
devenperez
2023-01-08 09:19:00 -05:00
parent 7b2728ea47
commit 4cc7c8cc70
20 changed files with 0 additions and 498 deletions
-38
View File
@@ -1,38 +0,0 @@
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
sum = ListNode((l1.val + l2.val) % 10)
carry = (l1.val + l2.val) / 10
follow = sum
num1 = l1.next
num2 = l2.next
while num1 != None or num2 != None or carry > 0:
if num1 == None and num2 == None:
follow.next = ListNode(carry)
carry = 0
elif num1 == None:
follow.next = ListNode((num2.val + carry) % 10)
follow = follow.next
carry = (num2.val + carry) / 10
num2 = num2.next
elif num2 == None:
follow.next = ListNode((num1.val + carry) % 10)
follow = follow.next
carry = (num1.val + carry) / 10
num1 = num1.next
else:
follow.next = ListNode((num1.val + num2.val + carry) % 10)
follow = follow.next
carry = (num1.val + num2.val + carry) / 10
num1 = num1.next
num2 = num2.next
return sum
-1
View File
@@ -1 +0,0 @@
-33
View File
@@ -1,33 +0,0 @@
<h2><a href="https://leetcode.com/problems/add-two-numbers/">2. Add Two Numbers</a></h2><h3>Medium</h3><hr><div><p>You are given two <strong>non-empty</strong> linked lists representing two non-negative integers. The digits are stored in <strong>reverse order</strong>, and each of their nodes contains a single digit. Add the two numbers and return the sum&nbsp;as a linked list.</p>
<p>You may assume the two numbers do not contain any leading zero, except the number 0 itself.</p>
<p>&nbsp;</p>
<p><strong>Example 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2020/10/02/addtwonumber1.jpg" style="width: 483px; height: 342px;">
<pre><strong>Input:</strong> l1 = [2,4,3], l2 = [5,6,4]
<strong>Output:</strong> [7,0,8]
<strong>Explanation:</strong> 342 + 465 = 807.
</pre>
<p><strong>Example 2:</strong></p>
<pre><strong>Input:</strong> l1 = [0], l2 = [0]
<strong>Output:</strong> [0]
</pre>
<p><strong>Example 3:</strong></p>
<pre><strong>Input:</strong> l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]
<strong>Output:</strong> [8,9,9,9,0,0,0,1]
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li>The number of nodes in each linked list is in the range <code>[1, 100]</code>.</li>
<li><code>0 &lt;= Node.val &lt;= 9</code></li>
<li>It is guaranteed that the list represents a number that does not have leading zeros.</li>
</ul>
</div>