>>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
}
}
>>804 まあええわ
俺もclassは久々に使ったけどできれば使わずに実装したかったわ