- 博客(166)
- 收藏
- 关注
原创 小米算法笔试
第一题:求矩阵相乘s1=input()m = int(s1.split()[0])k = int(s1.split()[1])n = int(s1.split()[2])A =[]B =[]for i in range(m): A.append([int(i) for i in input().split()])for i in range(k): B.append([int(i) for i in input().split()])def matrix_multipl
2020-09-08 19:54:11
1065
原创 将hive查询内容存储到文件中
首先先写一个shell脚本:hql=""hive -e "$hql" >> 文件名如果要输出表头:再加入configconfig="set hive.cli.print.header=true;"hql="$config"hive -e "$hql" >> 文件名
2020-07-08 14:47:17
624
原创 hadoop文件操作
将文件从服务器上传到hdfs上:hadoop fs -put 文件名 hdfs路径将文件从hdfs上拉到本地:hadoop fs -get hdfs路径 本地路径查看hdfs文件目录hadoop fs -ls 文件夹名
2020-07-08 14:41:47
530
原创 shell下将文件中的分隔符从‘\t‘转换成‘,‘
awk 'BEGIN{FS="\t";OFS=","}{$1=$1;print $0}' train.csv> data.train
2020-07-08 14:33:52
1586
原创 subline修改字体大小和空格问题
使用python的时候有时会碰到和identation相关的问题,很多时候是由于混用了空格和制表符。在sublime中显示空格和制表符后,便可以轻松修改。点击:preferences > settings:在右面输入:{ "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", "font_size": 10, "ignored_packages":[ "Vintage"],
2020-06-18 18:29:24
337
原创 linux使用手册
这两篇博客写的比较好:http://cn.linux.vbird.org/linux_basic/linux_basic.phphttps://www.linuxprobe.com/chapter-04.htmlxshell下拉取文件:sz上传:rz
2020-06-18 18:25:01
166
原创 \r:command not found
今天在xshell下运行.sh的脚本,里面写的是hive语句,但是报\r:command not find 的错误,查了一下说是linux下不能认出win的换行符,所以在vi界面下输入::set fileformat=unix即可将doc模式切换到unix模式,在win下编辑器里写的时候,也要注意先将模式切换到unix。切记不要在win和linux下来回的粘贴复制,这不是一个好的程序员的素养。...
2020-06-18 18:15:46
275
原创 拼多多算法笔试2020
https://www.nowcoder.com/test/question/4efe0a1953114c4ea5cdec4cddbbfa88?pid=23354036&tid=33813424import mathif __name__ == "__main__": t = int(input()) for i in range(t): n = int(input()) print(int(math.log(n,2))+1) # 二分法,每次.
2020-06-03 12:56:36
943
转载 k-means算法实现python
import numpy as npimport matplotlib.pyplot as plt# 两点距离def distance(e1, e2): return np.sqrt((e1[0]-e2[0])**2+(e1[1]-e2[1])**2)# 集合中心def means(arr): return np.array([np.mean([e[0] for e in arr]), np.mean([e[1] for e in arr])])# arr中距离a最远的元素
2020-05-22 22:55:21
292
原创 利用request库请求api
import requestsdef re(): url = 'http://shuyantech.com/api/entitylinking/cutsegment?q=' word = '打球的李娜和唱歌的李娜不是同一个人' url = url + word r = requests.get(url) print(r.text)if __name__ == "__main__": count = 0 while(True):
2020-05-13 13:25:50
224
原创 python opencv用法中文教程
https://www.cnblogs.com/Undo-self-blog/p/8423851.html
2020-01-09 13:37:03
166
原创 clion IDEA 2019 Activation Code
https://blog.youkuaiyun.com/qq_36875339/article/details/89601318
2020-01-01 14:35:42
5142
原创 scp远程传输文件时port 22: Operation timed out lost connection
查看端口号仍然是22,这是因为没有权限拷贝到远程服务器的其它文件,只能拷到根目录下
2019-12-20 10:47:44
3795
原创 深度学习环境配置
1.查看电脑上是否有gpu2.下载按照gpu对应的显卡,这样电脑上就会显示有gpu了,可以使用gpu了3.下载安装cuda,因为有了gpu可以跑别人的项目,但是有了cuda就能对gpu自己编程。4.下载安装cudnn,它是一个处理神经网络的库,keras用tensorflow,tensorflow去调用cudnn,cudnn去调用cuda,cuda去调用gpu...
2019-12-19 21:56:37
199
原创 深入理解计算机系统
leal和mov的用法:https://blog.youkuaiyun.com/farmwang/article/details/75103220
2019-12-11 20:21:32
130
原创 leetcode 1202 python
题目要求:https://leetcode-cn.com/problems/smallest-string-with-swaps/class Solution: def smallestStringWithSwaps(self, s: str, pairs: List[List[int]]) -> str: p = {i:i for i in range(len(...
2019-12-11 20:10:25
144
原创 leetcode 200 python
题目要求:https://leetcode-cn.com/problems/number-of-islands/class Solution: def numIslands(self, grid: List[List[str]]) -> int: if not grid: return 0 row = len(grid) col =...
2019-12-11 19:03:57
224
原创 leetcode 130 python
题目要求:https://leetcode-cn.com/problems/surrounded-regions/class Solution: def solve(self, board: List[List[str]]) -> None: """ Do not return anything, modify board in-place ins...
2019-12-11 18:51:53
194
原创 c++数组
一维数组:https://www.runoob.com/cplusplus/cpp-arrays.html多维数组:https://www.runoob.com/cplusplus/cpp-multi-dimensional-arrays.html
2019-12-11 15:04:53
81
原创 leetcode 128 python
class Solution: def longestConsecutive(self, nums: List[int]) -> int: if not nums: return 0 nums.sort() longest_streak = 1 current_streak = 1 ...
2019-12-11 15:00:45
227
原创 xcode配置最新版opencv
关于下面这个部分的修改,无论试了网上所有的方法都报错,这是因为在include后面还有个opencv4文件夹,应该改为下面的路径:
2019-12-09 23:09:34
100
原创 leetcode 1025 python
题目要求:https://leetcode-cn.com/problems/divisor-game/思路:如果N是奇数,因为奇数的所有因数都是奇数,因此 N 进行一次 N-x 的操作结果一定是偶数,所以如果 a 拿到了一个奇数,那么轮到 b 的时候,b拿到的肯定是偶数,这个时候 b 只要进行 -1, 还给 a 一个奇数,那么这样子b就会一直拿到偶数,到最后b一定会拿到最小偶数2,a就输了。...
2019-12-09 19:38:33
135
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人