Skip to content

Instantly share code, notes, and snippets.

View elvisfromsouth's full-sized avatar

PavelBo elvisfromsouth

  • Berlin, Germany
View GitHub Profile
@elvisfromsouth
elvisfromsouth / MyIterator.kt
Created April 29, 2024 09:58
Iterator Recursion
// написать имплементацию интерфейса Iterator<T>, где Т может быть либо Int, либо Iterator<T>
interface MyIterator<T> {
fun hasNext(): Boolean
fun next(): T
}
class IntRecursionImpl(
items: List<Any>
): MyIterator<Int> {
class Solution:
def addTwoNumbers(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode]:
dummy = ListNode(0)
currentNode = dummy
extra = 0
while l1 or l2:
currentSum = extra