-
LeetCode OJ--Gas Station**
摘要:https://oj.leetcode.com/problems/gas-station/啊,好笨,刚开始一直超时,复杂度为n*n。class Solution {public: int canCompleteCircuit(vector &gas, vector &cost) { ...
阅读全文
-
LeetCode OJ--Insert Interval **
摘要:https://oj.leetcode.com/problems/insert-interval/给出有序的区间来,再插入进去一个,也就是区间合并。刚开始确立了几个思路,看要插入的区间的start和end分别位于什么位置。区分是在空闲处还是在一个区间里面,并且还要判断跨越了几个区间,并且要进行数组元...
阅读全文
-
LeetCode OJ--Search Insert Position
摘要:https://oj.leetcode.com/problems/search-insert-position/数组有序,给一个数,看它是否在数组内,如果是则返回位置,如果不在则返回插入位置。因为原数组有序,所以使用二分查找。注意:如果是要插入这个元素的话,当target元素小于begin时候,是在...
阅读全文
-
Ruby自动化测试(操作符的坑)
摘要:事情是这样的:1 times++2 @ddr = DDR::DDR.new()执行到这里的时候,总是报错:'+@' undefied method。刚开始的时候以为是机器在重启过程中一些不稳定函数调用或者参数混乱造成的。于是改成:times++sleep(60 * 5)@ddr = DDR::DDR...
阅读全文
-
LeetCode OJ--Merge Sorted Array *
摘要:http://oj.leetcode.com/problems/merge-sorted-array/两个有序数组A和B的归并排序,将结果存到A中。因为已知两数组长度且A的数组足够大,所以倒着处理,如果正着的话,会有好多往后挪的操作。#include using namespace std;clas...
阅读全文
|