Fork me on GitHub
摘要: 题目 "腾讯2017暑期实习生编程题" 题目一 题目二 题目三 解析 C++ include include include include include include include include include include include include include include 阅读全文
posted @ 2018-03-19 20:53 ranjiewen 阅读(341) 评论(0) 推荐(0) 编辑
摘要: 61. Rotate List 题目 解析 题目;给定一个链表,将链表旋转到右边的k个位置,其中k是非负的。 例如: 1 2 3 4 5 NULL,为K = 2, 返还4 5 1 2 3 NULL。 / / 分析:先遍历一遍,得出链表长度len,注意k可能会大于len,因此k%=len。 将尾结点n 阅读全文
posted @ 2018-03-19 16:51 ranjiewen 阅读(226) 评论(0) 推荐(1) 编辑
摘要: 60 Permutation Sequence 题目 解析 这题不可以用递归的解法,否则不管怎么优化都会超时,这题时间卡得很紧啊。。。之前一直在优化递归,从几百毫秒优化到 9 毫秒依然不行。遂放弃,上网学习大神的解法,才发现这题是有数学技巧的。 具体来说是:n 个数字有 n!种全排列,每种数字开头的 阅读全文
posted @ 2018-03-19 16:02 ranjiewen 阅读(161) 评论(0) 推荐(0) 编辑