package utils;public class Functions {public static ListNode genSinglyListedNodes(int[] vals) {if (vals.length == 0) return null;ListNode head = new ListNode(vals[0]);ListNode cur = head;for (int i = 1; i < vals.length; i++) {cur.next = new ListNode(vals[i]);cur = cur.next;}return head;}public static void printSinglyListedNodes(ListNode head) {if (head == null) return;while (head.next != null) {System.out.printf("%d->", head.val);head = head.next;}System.out.printf("%d\n", head.val);}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。