public static ListNode lineUp (ListNode head) { if (head == null || head.next==null)return head; // write code here ListNode node = head.next; ListNode jishu = head.next; int flag = 2; StringBuilder s = new StringBuilder(); while (node != null){ if(flag % 2 == 1){ jishu.val = node.val; jishu = jishu.next; } else { s.append(node.val).append(" "); } node = node.next; flag++; } String[] strings = s.toString().split(" "); for (String string : strings) { jishu.val = Integer.valueOf(string); jishu = jishu.next; } return head; } 这是我第一题ac代码
点赞 评论

相关推荐

10-30 19:23
已编辑
山东大学(威海) C++
牛至超人:其实简历是不需要事无巨细的写的,让对方知道你有这段经历就行了,最重要的是面试的时候讲细讲明白
点赞 评论 收藏
分享
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务