20/10/29 10:47:03.25 jsAu6jIB.net
>>797 js
入出力のサンプルケース書いてないやつ絶対自分はやってないだろ
class SinglyLinkedList {
push(value) {
this.head = { next: this.head, value }
}
pop() {
if (!this.head) return
this.head = this.head.next
}
str() {
let { head } = this, s = ""
while (head) {
s += head.value + ", "
head = head.next
}
return s
}
}