摘要:
Write code to partition a linked list around a value x, such that all nodes less than xcome before alt nodes greater than or equal to.分割一个链表,将值小于x的节点全部放在其他节点的前面。解答:我们可以创建两个不同的链表,其中一个用来连接比x小的节点,另外一个则连接大于等于x的节点,然后合并两个链表即可。public class Main { public static void appendToTail(List head, int d) { ... 阅读全文