Files
hello-algo/ja/codes/java/utils/ListNode.java
T
Yudong Jin 7257641e0e Retranslate the complete Japanese online edition from Chinese (#2008)
* Retranslate the complete Japanese online edition from Chinese

* Fit Japanese homepage labels and localize heading permalinks

* Point Japanese contribution instructions to the Japanese preview

* Replace locale conditionals with multilingual UI tables
2026-10-30 02:12:26 +08:00

29 lines
616 B
Java

/**
* File: ListNode.java
* Created Time: 2022-11-25
* Author: krahets ([email protected])
*/
package utils;
/* 連結リストのノード */
public class ListNode {
public int val;
public ListNode next;
public ListNode(int x) {
val = x;
}
/* リストをデシリアライズして連結リストにする */
public static ListNode arrToLinkedList(int[] arr) {
ListNode dum = new ListNode(0);
ListNode head = dum;
for (int val : arr) {
head.next = new ListNode(val);
head = head.next;
}
return dum.next;
}
}