自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

MissZhou要努力

路漫漫其修远兮,吾将上下而求索

  • 博客(10)
  • 收藏
  • 关注

原创 已知random7求random10

头条一面 ,其实之前是看过的,宇宙条问的太太太难了QAQ这样想random7()返回的1,2,3,4,5,6,7经过加减乘除这类的运算至少应该是扩充到比10大的数据范围,才能进行取模运算那么应该想到7*(random7()-1)+random7() 可以扩充到1-49而且是等概率的比49小的最大的能被10整除的是40,那么大于40的就舍弃int random7(){ ...

2018-11-13 19:07:55 2501 2

原创 Redis实现购物网站

1.登录与Cookie缓存使用一个hash存储登录cookie令牌与已经登录用户之间的映射,检查用户是否已经登录,返回IDdef check_token(conn, token): return conn.hget('login:', token)#hget 获取哈希值key的value更新令牌def update_token(conn, token, user, it...

2018-11-07 18:55:13 679 1

原创 leetcode 89. Gray Code【枚举格雷码】

https://leetcode.com/problems/gray-code/description/The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the tota...

2018-11-07 11:55:08 178

原创 docker-Machine&Swarm

Docker Machine项目负责在多种平台上快速安装Docker环境 基于go语言实现支持多种后端驱动,包括虚拟机、本地主机和云平台先要安装docker-machine按着教程的写 总提示/usr/local/bin权限不足只要曲线救国$ curl -L https://github.com/docker/machine/releases/download/v0.13...

2018-11-06 16:10:04 1827

原创 leetcode 86. Partition List【分裂ListNode】

https://leetcode.com/problems/partition-list/description/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 pre...

2018-11-06 11:09:50 228

原创 Redis实现简单文章投票

鉴于Redis被鹅厂一面二面问过的原因还是要好好学习一下《Redis实战》第一章的例子实现的功能1)给文章投票def article_vote(conn,user,article): cutoff=time.time()-ONE_WEEK_IN_SECONDS if conn.zscore('time:',article)<cutoff: return art...

2018-11-05 14:58:25 754

原创 leetcode 82. Remove Duplicates from Sorted List II【删除链表重复字符】

Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.Example 1:Input: 1->2->3->3->4->4->5Output: 1-&gt...

2018-11-05 10:23:08 155

原创 leetcode 80. Remove Duplicates from Sorted Array II【c++for循环】

Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length.Do not allocate extra space for another array, you must do this by mod...

2018-11-03 10:54:01 159

原创 leetcode 79. Word Search【dfs找方格中出现字符串】

https://leetcode.com/problems/word-search/description/Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where...

2018-11-02 11:11:31 180

原创 leetcode 75. Sort Colors【荷兰旗问题】

基于快排的思想回忆一下快排的思路:把第一个位置的作为pivot,从右遍历直到发现有比pivot小的,交换;从左遍历,直到发现有比pivot大的,交换注意这里交换的都是当前的low和high,直到low,high相遇,本轮停止如果数字里面只有0,1,2那么显然只需要一次while就可以结束思路依旧是l r currentcurrent==0 需要和low交换,使得0都在左侧...

2018-11-01 13:56:37 175

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除