自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

cs学徒的周记

记录一个cs学徒的学习历程

  • 博客(70)
  • 资源 (1)
  • 收藏
  • 关注

原创 关于MYSQL left join 的一些细节问题

之前学 mysql 的时候 A left join B 应该是保全 A 表数据如果B表没有则显示 Null, 发现在衔接 where 语句的时候还有一些细节要考虑因为 where 是最后执行进行筛选,因此如果B表里面没有出去会被过滤掉即:如果where的条件和 A相关, 还是会有 B的Null如果where的条件和B相关, 不会B的null值解决方式:在where之前先筛一遍B方法一. 使用 ON...AND 语句:SELECT SQL_NO_CACHE platform.

2020-11-20 11:28:31 333

原创 关于rabbitmq pika包 reset by peer 的解决方式

写系统的时候要传给另一个模块数据, 直接用了rabbitmq 没用 celery分发, 然后因为对 AMQP 协议不熟在heartbeat 上出了很多问题。1. heartbeat 不能为 0, 已经设置过,但是可能当时没有内存扩容(这就要说AWS家辣鸡需要自己手动扩容了,否则只有8G存储空间)不知道为什么经常消费者会收不到信息, 怀疑是分配的资源用完了,要么就是丢包自己又不知道,还傻乎乎地等着,又没有 timeout这个让它停下2. 执行长任务的时候会出问题: 错误:pika.exceptio

2020-10-10 17:57:57 2491

原创 2020-09-26

在公司的辣鸡电脑里面装rabbitmq的时候,有时候会需要解决这个问题问题集中在联想家的电脑https://blog.youkuaiyun.com/zhm3023/article/details/82217222

2020-09-26 20:19:47 169

原创 django 头部

最近用django 来实现JWT验证的时候发现, 使用django框架提取头部key的时候框架会自己加一些神奇的地方:如果用 self.request.META:自己定义的变量会变成user -> HTTP_USERuser-name -> HTTP_USER_NAME如果使用self.request.headers定义的变量会变成user -> Useruser-name ->UserName 双峰命名因此我关于认证头部的中间件代码会..

2020-09-14 00:16:13 200

原创 关于 xpath 中 string(.)的使用方式

可以提取 html element 底下的所有 tag 中的元素的text() 并且帮你拼起来, 这样就不需要用正则先清理一遍标签了。 import requests r = requests.get("https://kns.cnki.net/KCMS/detail/detail.aspx?dbcode=CJFQ&dbn response = r

2020-08-11 11:14:04 1775

原创 pip 换源记录

简单的临时换一下:pip install web.py -i http://pypi.douban.com/simple --trusted-host pypi.douban.com来源:https://www.cnblogs.com/hjbf/p/10645347.html永久改一下:https://blog.youkuaiyun.com/innocent_cat/article/details/90481199?utm_medium=distribute.pc_relevant.none-ta.

2020-07-09 10:50:35 158

原创 记录一下华为的两次机试:找出有向图中所有的圈并且输出/算合法字符串/计算器

华为的一道机试题目,不知道为什么自己脑子抽了一下想了很久很久(其实主要还是DFS太不熟了代码也不是很elegant,将就记录一下。class Node: def __init__(self, data, next = None): self.data = data self.next = nextdef dfs(graph, stack, des...

2020-03-11 18:47:04 402

原创 9.29 练手 腾讯50题 344.颠倒字符串

Leetcode344.Reverse StringWrite a function that reverses a string. The input string is given as an array of characterschar[].Do not allocate extra space for another array, you must do this by...

2019-09-29 22:52:27 151

原创 9.28 练手 腾讯50题 9.回文数 43.字符串数字相乘

Leetcode 9.Palindrome Number思路是先转换成字符串然后两边双指针检测,代码如下:class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x<0: ...

2019-09-28 20:24:13 132

原创 9.26 练手 腾讯50题 8.atoi

Leetcode 8.String to Integer (atoi)如何将字符串转为有效数字题,代码如下:class Solution(object): def myAtoi(self, str): """ :type str: str :rtype: int """ if str == None...

2019-09-26 22:08:39 148

原创 9.23 练手 腾讯50题 237 删除链表

Leetcode237.Delete Node in a Linked List给一个节点,在链表中删除这个节点,不返回任何值。代码如下:class Solution(object): def deleteNode(self, node): """ :type node: ListNode :rtype: void Do n...

2019-09-23 21:59:20 107

原创 9.22 练手 腾讯50题 160 寻找两链表交点

Leetcode160.Intersection of Two Linked ListsWrite a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:begin to...

2019-09-22 22:09:01 113

原创 9.21 练手 腾讯50题 反转链表

Leetcode206.Reverse Linked ListReverse a singly linked list.Example:Input: 1->2->3->4->5->NULLOutput: 5->4->3->2->1->NULLFollow up:A linked list can be re...

2019-09-21 23:34:40 105

原创 9.19 练手 腾讯50题 142 链表找回环II

Leetcode142.Linked List Cycle II步骤为:判断是否有环 —>没有 return None —>有 一个一个走直到在环的入口相遇代码如下:class Solution(object): def detectCycle(self, head): """ ...

2019-09-19 18:42:42 94

原创 9.17 练手 腾讯50题 61旋转链表

Leetcode61.Rotate ListGiven a linkedlist, rotate the list to the right bykplaces, wherekis non-negative.Example 1:Input: 1->2->3->4->5->NULL, k = 2Output: 4->5->1-...

2019-09-17 00:29:41 109

原创 9.15 练手 腾讯50题 2两数相加

Leetcode2.Add Two NumbersYou are given twonon-emptylinked lists representing two non-negative integers. The digits are stored inreverse orderand each of their nodes contain a single digit. Ad...

2019-09-15 12:11:51 113

原创 9.13练手 腾讯50题 238 除了自己之外的乘积

Leetcode238.Product of Array Except SelfGiven an arraynumsofnintegers wheren> 1, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnu...

2019-09-13 22:21:10 99

原创 9.12练手 腾讯50题 217

Leetcode217.Contains DuplicateGiven an array of integers, find if the array contains any duplicates.Your function should return true if any value appears at least twice in the array, and it sho...

2019-09-12 08:53:12 86

原创 9.11 练手 腾讯50题 121

Leetcode121.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 ...

2019-09-12 08:39:41 174

原创 9.10 练手 88

Leetcode 88.Merge Sorted ArrayGiven two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:The number of elements initialized innums1andnums2aremandn...

2019-09-10 23:16:20 106

原创 9.9 练手 腾讯50题 62

Leetcode62.Unique PathsA robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The rob...

2019-09-09 09:46:57 102

原创 9.8 练手 腾讯50题 59螺旋矩阵2

Leetcode 59.Spiral Matrix IIGiven a positive integern, generate a square matrix filled with elements from 1 ton2in spiral order.Example:Input: 3Output:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7,...

2019-09-08 18:18:38 91

原创 9.7 练手 腾讯50题 54螺旋矩阵

Leecode54.Spiral MatrixGiven a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.Example 1:Input:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]O...

2019-09-07 20:09:19 113

原创 9.5 练手 腾讯50题 Search in Rotated Sorted Array

Leetcode33.Search in Rotated Sorted ArraySuppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e.,[0,1,2,4,5,6,7]might become[4,5,6,7,0,1,2]).You...

2019-09-05 18:00:34 92

原创 9.4 练手 腾讯50题 3Sum

Leetcode15.3SumGiven an arraynumsofnintegers, are there elementsa,b,cinnumssuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:The solutio...

2019-09-04 18:08:49 82

原创 9.3练手 腾讯50题 16最接近三数和

Leetcode16.3Sum ClosestGiven an arraynumsofnintegers and an integertarget, find three integers innumssuch that the sum is closest totarget. Return the sum of the three integers. You may a...

2019-09-03 20:25:06 111

原创 9.2 练手 腾讯50题 11算水槽容量

11.Container With Most WaterGivennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of lineiis...

2019-09-02 18:44:03 225

原创 8.31 练手 腾讯50题 643

Leetcode643.Maximum Average Subarray IGiven an array consisting ofnintegers, find the contiguous subarray of given lengthkthat has the maximum average value. And you need to output the maximum ...

2019-08-31 22:43:33 84

原创 8.30 练手 腾讯50题 83

Leetcode83.Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear onlyonce.Example 1:Input: 1->1->2Output: 1->2Exampl...

2019-08-30 19:18:05 86

原创 8.29 练手 腾讯50题 4

Leetcode4.Median of Two Sorted ArraysThere are two sorted arraysnums1andnums2of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be...

2019-08-29 18:54:56 112

原创 8.26 练手 腾讯50题 146 292

Leetcode146.LRU Cache运用你所掌握的数据结构,设计和实现一个LRU (最近最少使用) 缓存机制。它应该支持以下操作: 获取数据get和 写入数据put。获取数据get(key)- 如果密钥 (key) 存在于缓存中,则获取密钥的值(总是正数),否则返回 -1。写入数据put(key, value)- 如果密钥不存在,则写入其数据值。当缓存容量...

2019-08-26 01:10:29 304 1

原创 8.20 练手 腾讯50题 235 236

Leetcode235.Lowest Common Ancestor of a Binary Search TreeGiven a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LC...

2019-08-20 22:29:44 117

原创 8.19 练手 腾讯50题 230

Leetcode230.Kth Smallest Element in a BSTGiven a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's t...

2019-08-19 22:08:14 191

原创 8.18练手 腾讯50题 124

Leetcode 124.Binary Tree Maximum Path SumGiven anon-emptybinary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node...

2019-08-18 22:17:51 73

原创 8.16 练手 腾讯50题 104

Leetcode104.Maximum Depth of Binary Tree寻找二叉树的最大深度Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the fa...

2019-08-16 20:12:54 81

原创 8.15 练手 腾讯50题 231

Leetcode231.Power of TwoGiven an integer, write a function to determine if it is a power of two.Example 1:Input: 1Output: true Explanation: 20= 1Example 2:Input: 16Output: trueExp...

2019-08-15 15:18:31 72

原创 8.13练手 腾讯50题 169

Leetcode 169.Majority ElementGiven an array of sizen, find the majority element. The majority element is the element that appearsmore than⌊ n/2 ⌋times.You may assume that the array is non-em...

2019-08-12 20:43:41 102

原创 8.12 练手 腾讯50题 136

Leetcode136.Single NumberGiven anon-emptyarray of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Cou...

2019-08-12 18:13:45 92

原创 8.11 练手 腾讯50题 78

Leetcode78.SubsetsGiven a set ofdistinctintegers,nums, return all possible subsets (the power set).Note:The solution set must not contain duplicate subsets.Example:Input: nums = [1,2,3]...

2019-08-11 16:26:54 258

原创 8.10 练手 腾讯50题 148

Leetcode148.Sort List单向链表排序,O(nLog(n))的时间复杂度和常数的空间复杂度。因为常数的空间复杂度不能另外开数组排序或者链表比较。O(nLog(n))说明应该用的不是冒泡插入等,可能是归并或者快排。解法一:归并排序.class Solution(object): def sortList(self, head): ...

2019-08-10 18:20:52 131

QT+VS2013扫雷游戏+音效背景音乐控制+排行榜+难度设置

本人的课设。 QT版本的扫雷游戏。 完善了背景音乐、音效以及排行榜和难度设置。 单双击没弄好,只能通过滚轮实现双击。 如有不解的地方可以直接问我。

2017-06-17

空空如也

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

TA关注的人

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