蚂蚁不在线

2018年7月25日

leetcode python 005

摘要: ## 给定字符串,寻找最长回文子串## 单回文,双回文def findh(s): ## 单回文 ld,l=[],len(s) if len(s)<3: return 'too short' for i in range(1,l-1): for j in range(1,min(i+1,l-i)): 阅读全文

posted @ 2018-07-25 14:49 蚂蚁不在线 阅读(222) 评论(0) 推荐(0) 编辑

leetcode python 004

摘要: ## 已知l1,l2均为升序数组,## 在两数组l1,l2中寻找第n位数,## 两数组中位数中,前者大于后者,说明后者中位数以下的成员必定在真正中位数之下## 可以将其剔除,剔除a个元素后的两数组中寻找第n-a位数,等价于def findmid(l1,l2): m,n=len(l1),len(l2) 阅读全文

posted @ 2018-07-25 14:48 蚂蚁不在线 阅读(437) 评论(0) 推荐(0) 编辑

2018年7月14日

leetcode python 003

摘要: ## 给定一个字符串,求其最长无重复的子字符串##给定“abcabcbb”,答案是“abc”,长度为3。##给定“bbbbb”,答案是“b”,长度为1。##鉴于“pwwkew”,答案是“wke”,长度为3。import timeimport randomimport stringx,l=1000,[ 阅读全文

posted @ 2018-07-14 14:09 蚂蚁不在线 阅读(139) 评论(0) 推荐(0) 编辑

leetcode python 002

摘要: ##002 Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) Output: 7 -> 0 -> 8# 链表节点都是一位数字,以上可以视为243+564=807#先定义节点和链表类import numpy as npimport timeclass Node(object): 阅读全文

posted @ 2018-07-14 12:35 蚂蚁不在线 阅读(108) 评论(0) 推荐(0) 编辑

leetcode python 001

摘要: 给定一个数组,和一个数字target,要求返回和为target的两个数组成员的下标。 import numpy as npimport time #### 构造题目 , x数组大小x=100000l1=np.random.rand(x)l2=[round(l*x,5) for l in l1]w1= 阅读全文

posted @ 2018-07-14 12:34 蚂蚁不在线 阅读(78) 评论(0) 推荐(0) 编辑

2018年7月13日

sas 变量类型转换

摘要: data b2; set b1; newbl=put(oldbl,10.); run; 根据转换后的类型灵活填写 阅读全文

posted @ 2018-07-13 14:05 蚂蚁不在线 阅读(334) 评论(0) 推荐(0) 编辑

2018年7月5日

sas 选择一段日期,和一定周期,生成日期序列和周期序列

摘要: 工作需要,得选择一段日期,和一定周期,生成日期序列和周期序列。暂时用七天为一个周期 data d; format date date9.; do date='04mar2018'd to'05may2018'd; week=(date-mod((date-'04mar2018'd),7)-'04ma 阅读全文

posted @ 2018-07-05 15:03 蚂蚁不在线 阅读(528) 评论(0) 推荐(0) 编辑

2018年6月27日

斗鱼直播弹幕爬虫

摘要: 斗鱼弹幕服务器和一般的网页内容不一样,通过socket通信连接。斗鱼规定了弹幕的协议。 过程如下: 向斗鱼弹幕服务器发起连接房间请求,服务器回应;发起进入弹幕组请求,服务器回应;然后服务器持续发送弹幕消息,服务器要求每45s发送一次心跳包。 具体协议内容请搜索斗鱼弹幕服务协议。 我找了8个房间,获取 阅读全文

posted @ 2018-06-27 18:34 蚂蚁不在线 阅读(622) 评论(0) 推荐(0) 编辑

导航