Tags » Merge

Gett in advanced talks to buy Juno for $250M as Uber rivals consolidate

As Uber continues to work through its many layers of turmoil as a business, its smaller rivals are seizing the moment and consolidating to double down on their own ambitions in transportation-on-demand. 739 more words

Uber

The Start/Merge

How did The Pass Line start?  How did we become WTP PL Guys?

When I initially came up with the idea of “blogging,” I didn’t really think it would go anywhere.  688 more words

WTP Pass Line

23. Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.

/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode(int x) { val = x; }
 * }
 */
public class Solution {
    public ListNode mergeKLists(ListNode[] lists) {
        if (lists == null || lists.length == 0) {
            return null;
        }
        return helper(lists, 0, lists.length - 1);
    }

    private ListNode helper(ListNode[] lists, int left, int right) {
        if (left < right) {             int mid = left + (right - left) / 2;             ListNode l = helper(lists, left, mid);             ListNode r = helper(lists, mid + 1, right);             return mergeTwo(l, r);         }         return lists;     }          private ListNode mergeTwo(ListNode node1, ListNode node2) {         ListNode dummy = new ListNode(-1);         ListNode cur = dummy;         while (node1 != null && node2 != null) {             if (node1.val > node2.val) {
                cur.next = new ListNode(node2.val);
                node2 = node2.next;
            } else {
                cur.next = new ListNode(node1.val);
                node1 = node1.next;
            }
            cur = cur.next;
        }
        if (node1 != null) {
            cur.next = node1;
        }
        if (node2 != null) {
            cur.next = node2;
        }
        return dummy.next;
    }
}

// version 2: Heap, not familiar. 129 more words
Java

Look at birth trends when planning for education

(Source: www.straitstimes.com)

I read with interest about the Education Ministry’s decision to merge schools due to the falling birth rate (8 junior colleges among 28 schools to be merged… 246 more words

Current Affairs

Anyone else out there dreaming?

If you are somebody who knows that nothing is real and everything is a dream and if you met your twin sister or twin brother and if you think that you and your twin sister or twin brother and some number of kids are the only real people in this dream world and if you think there might be other real people in this dream world (or possibly you already know other real people who are not avatars) then please contact me by sending a letter to my internet letter address which is: 74 more words