摘要:
Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below 阅读全文
摘要:
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the 阅读全文
摘要:
Write a function to find the longest common prefix string amongst an array of strings 题目:找vector中最长公共前缀, 思路:模拟比较的过程,我们可以看到这些. 按照数组中的第一个字符串开始进行比较, 对第一个 阅读全文
摘要:
Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element i 阅读全文
摘要:
Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each elemen 阅读全文
摘要:
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then l 阅读全文
摘要:
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy 阅读全文
摘要:
Sort a linked list in O(n log n) time using constant space complexity. 题目:有时间和空间复杂度限制 单链表适合利用归并排序, 双向链表适合利用快速排序, 复用mergeTwoList()代码 1,利用fast/slow方法找到链 阅读全文
摘要:
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 合并k个链表形成一个已排序链表 思路: 如何合并两个有序链表?经典merge算法: 对vector中的 阅读全文