摘要:
Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Your a 阅读全文
摘要:
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 时间复杂度 O(nlogk)思路: 这道题其实有三种做法,第一种是priorityQueue,第二种是 阅读全文
摘要:
Write a function to find the longest common prefix string amongst an array of strings. 思路: 这道题其实很简单,但是比较别扭的是这道题不是一般情况下的按层来遍历,而是按列来遍历。可以考虑用第一个string做外层 阅读全文