摘要: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 题意:将整数转换成罗马数字,这里就需要对什么是罗马数字有一些了解。一下部分摘选于百度 阅读全文
posted @ 2017-06-20 10:52 王大咩的图书馆 阅读(490) 评论(0) 推荐(1) 编辑
摘要: Given a linked list, remove the n th node from the end of list and return its head. For example, Note: Given n will always be valid.Try to do this in 阅读全文
posted @ 2017-06-19 20:38 王大咩的图书馆 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 思路:这题最容易想到的是,(假设有k个链表)链表1、2合并,然后其结果12和3合并,以此类推,最后是1 阅读全文
posted @ 2017-06-19 20:15 王大咩的图书馆 阅读(528) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, swap every two adjacent nodes and return its head. For example,Given1->2->3->4, you should return the list as2->1->4->3. Your alg 阅读全文
posted @ 2017-06-19 16:46 王大咩的图书馆 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2017-06-19 16:27 王大咩的图书馆 阅读(376) 评论(0) 推荐(0) 编辑
摘要: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single 阅读全文
posted @ 2017-06-19 10:22 王大咩的图书馆 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 现在都不知道操作系统是什么东东,然后就看点书了解一下,参考书不是专门讲操作系统的,是看到的时候做的笔记。 以下内容来自赖国明主编《Linux 网络操作系统项目化教程》第一节。 操作系统 一个完整的计算机系统包括:硬件子系统和软件子系统。据诺依曼原理,计算机的硬件子系统包括:运算器、控制器、存储器、输 阅读全文
posted @ 2017-06-18 11:38 王大咩的图书馆 阅读(931) 评论(0) 推荐(0) 编辑
摘要: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the 阅读全文
posted @ 2017-06-17 16:32 王大咩的图书馆 阅读(323) 评论(0) 推荐(0) 编辑
摘要: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given1->2->3->4->5->NULL, m = 2 and n = 4, return1->4->3->2->5 阅读全文
posted @ 2017-06-16 15:01 王大咩的图书馆 阅读(236) 评论(0) 推荐(0) 编辑
摘要: Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given1->2->3->4->5->NULLand k =2,return4->5->1->2->3->NUL 阅读全文
posted @ 2017-06-16 11:17 王大咩的图书馆 阅读(205) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull. Follow up:Can you solve it without using extra space? 题 阅读全文
posted @ 2017-06-15 20:47 王大咩的图书馆 阅读(417) 评论(0) 推荐(1) 编辑
摘要: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 判断链表中是否有环,不能用额外的空间,可以使用快慢指针,慢指针一次走一步,快指针 阅读全文
posted @ 2017-06-15 15:39 王大咩的图书馆 阅读(216) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list L: L 0→L 1→…→L n-1→L n,reorder it to: L 0→L n →L 1→L n-1→L 2→L n-2→… You must do this in-place without altering the nodes' 阅读全文
posted @ 2017-06-15 15:21 王大咩的图书馆 阅读(1777) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list in O(n log n) time using constant space complexity. 时间复杂度为O(nlogn),可以想到归并排序、快排、桶排序。 思路:使用归并排序,整体可以分为两体,一、构造两个已排序的子链表;二、将子链表合并。针对第一部 阅读全文
posted @ 2017-06-15 08:55 王大咩的图书馆 阅读(849) 评论(0) 推荐(0) 编辑
摘要: 恢复内容开始 Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 题目要求:转成高度平衡的二叉搜索树。 高度平衡的二叉搜索树:i)左 阅读全文
posted @ 2017-06-14 20:13 王大咩的图书馆 阅读(269) 评论(0) 推荐(0) 编辑