Given an input.txt
that represents a linked list a -> b -> c -> d -> e
as a series of nodes with next
pointers:
a>b
b>c
c>d
d>e
Reverse the linked list such that the output reads:
Given an input.txt
that represents a linked list a -> b -> c -> d -> e
as a series of nodes with next
pointers:
a>b
b>c
c>d
d>e
Reverse the linked list such that the output reads:
while (current != null) { | |
next = current->next; | |
current->next = prev; | |
prev = current; | |
current = next; | |
} | |
head = prev; |
object Foo { | |
var initialized = 0 | |
// This only happens once regardless of how many times Foo.fetch() is called | |
initialized = initialized + 1 | |
def fetch(): Integer = initialized | |
} | |
class Foo { |