- 博客(17)
- 资源 (2)
- 收藏
- 关注
原创 Leetcode #516. Longest Palindromic Subsequence
Leetcode #516. Longest Palindromic Subsequence题目https://leetcode.com/problems/longest-palindromic-subsequence/description/代码比较典型的动态规划问题。递归写了一遍TLE了,循环方法没有问题。class Solution {public: ...
2018-05-06 17:09:03 166
原创 Leetcode #39. Combination Sum
Leetcode #39. Combination Sum题目https://leetcode.com/problems/combination-sum/description/代码class Solution {public: void foo(vector<int>& candidates, int target, int cidx, vect...
2018-04-12 20:08:17 186
原创 Leetcode #121. Best Time to Buy and Sell Stock
Leetcode #121. Best Time to Buy and Sell Stock题目https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/代码class Solution {public: int maxProfit(vector<int>& pr...
2018-04-11 23:39:51 163
原创 Leetcode #231. Power of Two
Leetcode #231. Power of Two题目https://leetcode.com/problems/power-of-two/description/代码我的:class Solution {public: bool isPowerOfTwo(int n) { if (n <= 0) return false; ...
2018-04-11 23:31:48 144
原创 Leetcode #780. Reaching Points
Leetcode #780. Reaching Points题目https://leetcode.com/problems/reaching-points/description/代码一开始的思路是逆向推,目的坐标(tx, ty)肯定是由(tx-ty, ty)或(tx, ty-tx),但是坐标限定不为负数,因此比较tx、ty的大小可以唯一确定上一步的步骤于是有:cl...
2018-04-10 23:23:55 230
原创 Leetcode #746. Min Cost Climbing Stairs
Leetcode #746. Min Cost Climbing Stairs题目https://leetcode.com/problems/min-cost-climbing-stairs/description/代码Simple Question. 没啥好说的,数组那里优化下,用两个变量就可以。class Solution {public: int minCo...
2018-04-10 22:40:40 162
原创 Leetcode #395. Longest Substring with At Least K Repeating Characters
Leetcode #395. Longest Substring with At Least K Repeating Characters题目链接https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters/description/代码思路:首先检查当前字符串是否满足...
2018-04-10 22:23:07 142
原创 Leetcode #7. Reverse Integer
class Solution: def reverse(self, x): """ :type x: int :rtype: int """ ret = 0 nega = 0 if x > 0 else 1 if nega: x = -x
2017-12-26 01:18:55 210
原创 Ubuntu下安装GPU版xgboost python库
安装过程见官方文档:http://xgboost.readthedocs.io/en/latest/build.html主要有以下两步1. 下载源代码git clone --recursive https://github.com/dmlc/xgboost2. 编译GPU共享库cd xgboostmkdir buildcd buildcmake .. -DUSE_C
2017-11-04 20:21:24 1554
原创 #6. ZigZag Conversion
1. 题目ZigZag字符串的描述见题目链接。给定行号,对于一个ZigZag字符串,需要按行号顺序输出每行的内容。2. 代码# 比较简单,将ZigZag字符串按顺序遍历,每个字符放入对应行中class Solution(object): def convert(self, s, numRows): """ :type s: str :type
2017-02-10 03:35:06 258
原创 leetcode #4: Median of Two Sorted Arrays
题目链接: Median of Two Sorted Arrays这道题坑还是有点多的,刚看到的时候第一反应是:这不就是归并排序....还是图样啊。所以先这样提交了:class Solution(object): def findMedianSortedArrays(self, nums1, nums2): """ :type nums1:
2016-07-31 00:33:51 322
原创 nachos lab1-线程机制
总体概述本次lab的主要内容是拓展nachos的线程机制,在nachos的线程模型中添加tid和uid,并添加相应的管理机制。本次lab的重要知识点在于对nachos中线程具体实现方式的理解, 任务完成情况Exercise 1 –> YExercise 2 –> YExercise 3 –> YExercise 4 –> Y具体完成情况如下所示:Exercise 1 调研 调研Lin
2016-07-31 00:27:10 6736
原创 TCPCopy
简介TCPCopy是一种请求复制(所有基于tcp的packets)工具,可以把在线流量导入到测试系统中。 Architecture如上图所示,tcpcopy由以下三个部分组成online serveronline server上运行tcpcopy,在网络层复制raw packets,tcpcopy修改包的目地址,发给测试机target servertarget server被测应用处理tcpcop
2016-07-31 00:19:58 639
原创 nachos lab3-线程同步
总体概述本次lab的主要内容是拓展同步机制,实现同步互斥实例本次lab的重要知识点在于对同步互斥原理的理解 任务完成情况Exercise 1 –> YExercise 2 –> YExercise 3 –> YExercise 4 –> YChallenge 1 –> YChallenge 2 –> Y具体完成情况如下所示:Exercise 1 调研 调研Linux中实现的同步机
2016-07-31 00:18:57 2526
原创 nachos lab2-线程调度
总体概述本次lab的主要内容是扩展线程调度算法,实现基于优先级的抢占式调度算法我认为,本次lab的关键在于理解Timer、Scheduler和Interrupt之间的关系,从而理解线程之间是如何进行调度的 任务完成情况Exercise 1 –> YExercise 2 –> YExercise 3 –> YChallenge 1 –> Y具体完成情况如下所示:Exercise 1 调研
2016-07-31 00:17:24 5621 2
原创 ruby2.1.1安装时编译源码,readline.c出现错误
系统是ubuntu14.04因为之前实验室机子坏了xu'yao'chong'zhuang
2014-10-09 21:21:41 774
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人