03 2018 档案

摘要: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 阅读全文

posted @ 2018-03-27 10:23 codingEskimo 阅读(130) 评论(0) 推荐(0)

摘要:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 时间复杂度 O(nlogk)思路: 这道题其实有三种做法,第一种是priorityQueue,第二种是 阅读全文

posted @ 2018-03-27 09:02 codingEskimo 阅读(120) 评论(0) 推荐(0)

摘要:Write a function to find the longest common prefix string amongst an array of strings. 思路: 这道题其实很简单,但是比较别扭的是这道题不是一般情况下的按层来遍历,而是按列来遍历。可以考虑用第一个string做外层 阅读全文

posted @ 2018-03-20 11:30 codingEskimo 阅读(153) 评论(0) 推荐(0)

摘要:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of 阅读全文

posted @ 2018-03-20 10:43 codingEskimo 阅读(109) 评论(0) 推荐(0)

导航