自定义博客皮肤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要努力

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

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

原创 中文对话情感分类调研

由这个比赛:https://god.yanxishe.com/5中的亚军代码https://god.yanxishe.com/codeplan/detail/41,发现了roeberta_zh_L-24_H-1024_A-16(貌似就是下文中的chinese_roberta_wwm_large_ext_L-24_H-1024_A-16.zip)这个模型,下载方法:https://github.com/brightmart/roberta_zhtensorflow 1.14.0 keras 2.

2021-03-29 10:17:54 436

原创 Python多进程写日志ConcurrentLogHandler

文档:https://pypi.org/project/ConcurrentLogHandler/0.9.1/这个类库是通过文件锁实现写日志进程安全的,但是只能通过文件大小控制切割,不能通过时间分割文件。demo:import timeimport logging, logging.configfrom cloghandler import ConcurrentRotatingFileHandlerfrom multiprocessing import Process def

2020-12-10 15:26:02 1288 1

原创 hive 复制一个分区到另一个分区

方法1:select insert。使用类似MySQL的方法 。这次没试方法2:hadoop fs -cp cosn://xxxxx/dt=20201121/* cosn://xxxxx/dt=20201123show partitions tablename发现新分区没数据需要修复分区MSCK REPAIR TABLE tablename...

2020-11-25 11:04:29 2308

原创 Python try finally执行过程

如果不考虑return,执行顺序是try- 若有异常 exception ,最终finally结束如果有return,先返回finally中的return .感谢老板不杀之恩......

2020-10-15 17:08:37 460

原创 查看进程信息

敝司都是用同一个用户名登录服务器的故 单纯的top -c看不出是谁但是top可以看出来进程号可以 进入/proc/pid 查看进程相关信息

2020-08-14 15:42:36 246

原创 hive奇奇怪怪的设置

0.hive建表的时候默认就在hdfs上,所以控制台取数直接hadoop fs -get即可1.hive默认没给update和delete的设置2.hive表最后一列就是分区键,所以当add column的后,desc不出现,需要alter table table_name change new_column new_column string after column1 ; _____未完_______...

2020-08-03 22:53:35 175

原创 虚拟机wifi联网

由于毕业前想提前学习->学py框架->安装py2->本机电脑安不上pip->虚拟机就得联网今天早上突然意识到昨天没搞对是因为没网线->一顿操作如下:1.在网络设置中WLAN的设置中勾选:允许其他网络用户通过此计算机的Internet来连接&控制禁用2.配置VMware net8 主要是ip地址?我好像没改,默认是这个3.虚拟机的虚拟网络编辑器:NAT设置-网关IP&子网IP,子网掩码4.设置虚拟机内部网络 在添加配置里面.

2020-06-10 11:04:06 676

原创 由MySQL too many connections引起的事故

问题起因oj有一个给contest匹配namelist的功能:选择已经insert的名单,添加到contest的管理界面。其中有两个更新名单的按钮不会自动去重,即 选择名单后,点击两次会插入两次相同的95人名单,共计190条记录。为了暂时解决这个问题,我直接在MySQL中删除了后添加的95条数据。然后通过浏览器查看名单,OJ就崩了!!但是如果不看contest相关的功能,oj可以正常work。重启apache依旧只能正常访问非contest模块。这个时候我发现MySQL连不上了,显示

2020-05-13 14:26:55 438 1

原创 ERROR 2006 (HY000) at line 1061: MySQL server has gone away Operation failed with exitcode 1

导入mysql数据表内容,报错:ERROR 2006 (HY000) at line 1061: MySQL server has gone awayOperation failed with exitcode 1https://stackoverflow.com/questions/10474922/error-2006-hy000-mysql-server-has-gone-aw...

2020-03-29 17:28:57 935

原创 linux python根据csv文件信息 复制图片到不同文件夹下

import sysimport csvimport numpyimport pandasimport shutilimport osif __name__ == '__main__': f1 = pandas.read_csv('trainLabels.csv') print f1 record_num = int (f1.describe().ix[0,0]) print...

2020-01-09 11:12:30 387

原创 lintcode DP 总结

107.Word BreakFollowhttps://www.lintcode.com/problem/word-break/descriptionDescription中文EnglishGiven a string s and a dictionary of words dict, determine if s can be break into a space-separa...

2019-09-28 17:57:29 234

原创 lintcode 124. 最长连续序列[unordered_set]

https://www.lintcode.com/problem/longest-consecutive-sequence/description描述中文English给定一个未排序的整数数组,找出最长连续序列的长度。您在真实的面试中是否遇到过这个题?是题目纠错说明要求你的算法复杂度为O(n)样例样例 1输入 : [100, 4, 200, 1,...

2019-09-22 18:12:42 223

原创 lintcode87. 删除二叉查找树的节点 leetcode 450. Delete Node in a BST

Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.Basically, the deletion can be divided int...

2019-09-22 14:49:16 173

原创 lintcode 85. 在二叉查找树中插入节点

描述中文English给定一棵二叉查找树和一个新的树节点,将节点插入到树中。你需要保证该树仍然是一棵二叉查找树。保证不会出现重复的值您在真实的面试中是否遇到过这个题?是题目纠错样例样例 1: 输入: tree = {}, node= 1 输出: {1} 样例解释: 在空树中插入一个点,应该插入为根节点。 样例 2: 输入: tree...

2019-09-22 00:27:15 234

原创 lintcode 11. 二叉查找树中搜索区间

中序遍历一遍就好啦/** * Definition of TreeNode: * class TreeNode { * public: * int val; * TreeNode *left, *right; * TreeNode(int val) { * this->val = val; * this-&g...

2019-09-21 21:49:40 169

原创 lintcode 448. 二叉查找树的中序后继

本来以为 既然都是找后继 都是一样的结果 都!不!一!样!查找的时候怎么用val比较呢?考虑如果当前root的值比查找的 小于或等于:淘汰掉左子树就好要是需要找到左子树了,那么递归下去同样的方法,如果找不到,那么说明当前这个根节点是要找的class Solution {public: /* * @param root: The root of the B...

2019-09-21 20:59:15 183

原创 lintcode86. 二叉查找树迭代器

https://www.lintcode.com/problem/binary-search-tree-iterator/description看着这个题无比眼熟之前亚麻暑假实习manager问过我然而 那会是有父指针的这个题思路是什么呢?就变成了纯正的中序遍历非递归版的而且写法也有要求不能是while循环在外面的是要while current的然后就出了...

2019-09-21 18:03:41 160

原创 lintcode 95. 验证二叉查找树【剑指offer】

描述中文English给定一个二叉树,判断它是否是合法的二叉查找树(BST)一棵BST定义为:节点的左子树中的值要严格小于该节点的值。 节点的右子树中的值要严格大于该节点的值。 左右子树也必须是二叉查找树。 一个节点的树也是二叉查找树。您在真实的面试中是否遇到过这个题?是题目纠错样例样例 1:输入:{-1}输出:true解释:二叉树如下(仅有一个...

2019-09-21 01:16:22 167

原创 leetcode124. Binary Tree Maximum Path Sum

昨天晚上写了大概 今天晚上调了不到20分钟 做出了hard撒花就是dfs+dp的结合之前在微软面经看到过:)124.Binary Tree Maximum Path SumHard1992150FavoriteShareGiven anon-emptybinary tree, find the maximum path sum.For this proble...

2019-09-20 23:05:09 188

原创 lintcode 88LCA

https://lintcode.com/problem/lowest-common-ancestor-of-a-binary-tree/description描述中文English给定一棵二叉树,找到两个节点的最近公共父节点(LCA)。最近公共祖先是两个节点的公共的祖先节点且具有最大深度。假设给出的两个节点都在树中存在您在真实的面试中是否遇到过这个题?是题目...

2019-09-20 00:44:14 229

原创 剑指offer 二叉搜索树转双向链表

https://www.nowcoder.com/practice/947f6eb80d944a84850b0538bf0ec3a5?tpId=13&tqId=11179&tPage=2&rp=2&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking第二个参数必须传二级指针...

2019-09-13 01:20:35 205

原创 剑指offer【栈的压入 弹出序列】

https://www.nowcoder.com/practice/d77d11405cc7470d82554cb392585106?tpId=13&tqId=11174&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking个人觉得 还是我写...

2019-09-12 01:23:33 153

原创 剑指offer判断是否是子树

这么水的题居然搞了这么久。。https://www.nowcoder.com/practice/6e196c44c7004d15b1610b9afca8bd88?tpId=13&tqId=11170&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranki...

2019-09-12 00:23:54 213

原创 leetcode 116. Populating Next Right Pointers in Each Node & 117. Populating Next Right Pointers in E

You are given aperfect binary treewhereall leaves are on the same level, and every parent has two children. The binary tree has the following definition:struct Node { int val; Node *left; ...

2019-09-09 22:54:12 172

原创 leetcode 146. LRU Cache

https://leetcode.com/problems/lru-cache/submissions/Design and implement a data structure forLeast Recently Used (LRU) cache. It should support the following operations:getandput.get(key)- Ge...

2019-09-08 23:38:53 153

原创 leetcode 165. Compare Version Numbers

https://leetcode.com/problems/compare-version-numbers/Compare two version numbersversion1andversion2.Ifversion1>version2return1;ifversion1<version2return-1;otherwise return0....

2019-09-06 00:41:52 130

原创 leetcode 348. Design Tic-Tac-Toe【模拟】

348.Design Tic-Tac-ToeMedium44332FavoriteShareDesign a Tic-tac-toe game that is played between two players on anxngrid.You may assume the following rules:A move is guaranteed to be vali...

2019-09-05 00:56:37 349

原创 leetcode 277. Find the Celebrity【思维】

277.Find the CelebrityMedium71894FavoriteShareSuppose you are at a party withnpeople (labeled from0ton - 1) and among them, there may exist one celebrity. The definition of a celebrity is ...

2019-09-05 00:00:14 196

原创 leetcode 151. Reverse Words in a String【剑指offer】

https://leetcode.com/problems/reverse-words-in-a-string/151.Reverse Words in a StringMedium6362394FavoriteShareGiven an input string, reverse the string word by word.Example 1:Input: ...

2019-09-03 01:07:03 164

原创 leetcode138. Copy List with Random Pointer【剑指offer】

https://leetcode.com/problems/copy-list-with-random-pointer/A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Retur...

2019-09-03 00:09:40 189

原创 lintcode 168. 吹气球【记忆化搜索+区间dp】

168.吹气球中文English有n个气球,编号为0到n-1,每个气球都有一个分数,存在nums数组中。每次吹气球i可以得到的分数为nums[left] * nums[i] * nums[right],left和right分别表示i气球相邻的两个气球。当i气球被吹爆后,其左右两气球即为相邻。要求吹爆所有气球,得到最多的分数。样例样例 1:输入:[4, 1, 5, 10]...

2019-09-01 12:20:24 214

原创 lintcode 89. K数之和【背包】

89.K数之和中文English给定n个不同的正整数,整数k(k<=n)以及一个目标数字target。 在这n个数里面找出k个数,使得这k个数的和等于目标数字,求问有多少种方案?样例样例1输入:List = [1,2,3,4]k = 2target = 5输出: 2说明: 1 + 4 = 2 + 3 = 5样例2输入:...

2019-09-01 12:09:57 331

原创 lintcode532. 逆序对/剑指offer【归并排序】

https://www.lintcode.com/problem/reverse-pairs/descriptionhttps://www.nowcoder.com/practice/96bd6684e04a44eb80e6a68efc0ec6c5?tpId=13&tqId=11188&tPage=1&rp=1&ru=/ta/coding-interviews&...

2019-08-25 23:44:07 207

原创 lintcode 382. 三角形计数【双指针】

https://www.lintcode.com/problem/triangle-count/description描述中文English给定一个整数数组,在该数组中,寻找三个数,分别代表三角形三条边的长度,问,可以寻找到多少组这样的三个数来组成三角形?您在真实的面试中是否遇到过这个题?是题目纠错样例样例 1:输入: [3, 4, 6, 7]输出: 3解...

2019-08-25 19:59:16 263

原创 leetcode 买卖股票【六题集合】

121.Best Time to Buy and Sell StockSay you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (i.e., buy...

2019-08-25 00:53:30 357

原创 lintcode 81. 数据流中位数[heap]

描述中文English数字是不断进入数组的,在每次添加一个新的数进入数组的同时返回当前新数组的中位数。您在真实的面试中是否遇到过这个题?是题目纠错说明中位数的定义:这里的中位数不等同于数学定义里的中位数。 中位数是排序后数组的中间值,如果有数组中有n个数,则中位数为A[(n-1)/2]A[(n−1)/2]。 比如:数组A=[1,2,3]的中位数是2,数组A=[1...

2019-08-21 22:20:13 218

原创 leetcode 215. Kth Largest Element in an Array

简直不懂为啥一个练手的题 能卡这么久Find thekth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.Example 1:Input: [3,2,1,5,6,4] and...

2019-08-20 00:42:02 138

原创 leetcode 11. Container With Most Water& lintcode 363. 接雨水

愚蠢如我这两个其实还不太一样的和这个http://acm.hdu.edu.cn/showproblem.php?pid=1506更不一样(后者是单调栈)https://www.lintcode.com/problem/trapping-rain-water/description由于图是酱婶的,所以需要一位一位的算class Solution {public: ...

2019-08-18 12:58:08 170

原创 lintcode 178. 图是否是树【并查集】

昨晚迷迷糊糊写的忘记了树的条件是不成环,今天捡起来debug半天才发现最后比较的不应该是父节点相同 而应该是根结点相同其实最明智的做法是判断给出的边数,如果之前没成环,边数=n-1,那么就是树!class Solution {public: /** * @param n: An integer * @param edges: a list o...

2019-08-08 20:38:45 340

原创 leetcode 130. Surrounded Regions【并查集】

https://leetcode.com/problems/surrounded-regions/Given a 2D board containing'X'and'O'(the letter O), capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's i...

2019-07-21 19:06:24 202

空空如也

空空如也

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

TA关注的人

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