
com_github_leetcode.ListNode.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-all Show documentation
Show all versions of leetcode-in-all Show documentation
104 LeetCode algorithm problem solutions
package com_github_leetcode
class ListNode(_x: Int = 0, _next: ListNode = null) {
var next: ListNode = _next
var x: Int = _x
override def toString: String = {
val result = new StringBuilder(x.toString)
var current = next
while (current != null) {
result.append(", ")
result.append(current.x)
current = current.next
}
result.toString
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy