自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(39)
  • 收藏
  • 关注

原创 React + React Router + GitHub Pages + Google Analytics踩坑之路

React + React Router + GitHub Pages + Google Analytics踩坑之路作者:LiuST我用React制作了一个单页应用(SPA),在后来的发布在GitHub Pages(或Coding Pages、Gitee Pages)上、引入React Router (v4)、使用Google Analytics分析用户浏览量,乃至用Google AdSens...

2020-01-14 10:18:35 723

原创 react router v4 中监听路由变化,使用google analytics

react使用router进行页面切换,google analytics不会知道你的页面发生了变化。所以要手动让它知道。安装react-ganpm install react-ga --save我在网上看到使用history.listen实现监听页面变化的代码:import createHistory from 'history/createBrowserHistory'im...

2020-01-12 05:23:28 1189

原创 leetcode 23. Merge k Sorted Lists的思路与python实现 (Priority Queue)

Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[ 1->4->5, 1->3->4, 2->6]Output: 1->1->2->3->4-...

2019-12-06 13:13:03 342

原创 leetcode 4. Median of Two Sorted Arrays的思路与python实现

思路基本只能靠背。边缘条件太恶心了...代码class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: m, n = len(nums1), len(nums2) if m > n: # 上面的要小一点...

2019-11-04 17:17:38 211

原创 leetcode 16. 3Sum Closest的思路与python实现

我的leetcode系列博文一般没什么参考价值,思路一般懒得叙述完整。代码可以看看,不过leetcode的discussion里有更好的。纯属随便记录。思路这题跟3SUM的做法差不多。记得先把数组sort了。在比较当前solution和存储的solution哪个好的时候,记得使用abs算绝对值。要思考的是3SUM里使用的left, right双指针寻找exactly的solut...

2019-11-01 13:31:44 104

原创 leetcode 2. Add Two Numbers的思路与python实现

You are given twonon-emptylinked lists representing two non-negative integers. The digits are stored inreverse orderand each of their nodes contain a single digit. Add the two numbers and return i...

2019-10-31 15:33:18 115

原创 leetcode 140. Word Break II的思路与python实现

Given anon-emptystringsand a dictionarywordDictcontaining a list ofnon-emptywords, add spaces insto construct a sentence where each word is a valid dictionary word.Return all such possible s...

2019-08-22 15:05:34 288

原创 leetcode 76. Minimum Window Substring的思路与python实现

Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).Example:Input: S = "ADOBECODEBANC", T = "ABC"Output: "BANC"Note:I...

2019-08-22 03:21:47 288

原创 leetcode 120. Triangle 的思路与python实现

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [6,5...

2019-08-14 20:45:15 204

原创 leetcode 133. Clone Graph的思路与python实现

Givena reference of a node in aconnectedundirected graph, return adeep copy(clone) of the graph. Each node in the graph contains a val (int) and a list (List[Node]) of its neighbors.Example:...

2019-08-13 21:02:01 174

原创 leetcode 146. LRU Cache的思路与python实现

Design and implement a data structure forLeast Recently Used (LRU) cache. It should support the following operations:getandput.get(key)- Get the value (will always be positive) of the key if th...

2019-08-10 18:04:03 170

原创 Amazon | Online Assessment 2019 | Roll Dice的思路与python实现

题目链接:https://leetcode.com/discuss/interview-question/331158/Amazon-or-Online-Assessment-2019-or-Roll-DiceA six-sided die is a small cube with a different number of pips on each face (side), ranging ...

2019-08-07 15:29:45 1833

原创 lintcode 629. Minimum Spanning Tree 的思路与python实现

Given a list of Connections, which is the Connection class (the city name at both ends of the edge and a cost between them), find edges that can connect all the cities and spend the least amount.Retu...

2019-08-02 12:24:52 490

原创 leetcode 25. Reverse Nodes in k-Group的思路与python实现

Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.kis a positive integer and is less than or equal to the length of the linked list. If the number of ...

2019-08-02 12:05:23 186

原创 leetcode 124. Binary Tree Maximum Path Sum的思路与python实现

Given 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 in the tree along the parent-child connectio...

2019-08-01 01:59:07 184

原创 leetcode 937. Reorder Log Files 的思路与python实现

You have an array oflogs. Each log is a space delimited string of words.For each log, the first word in each log is an alphanumericidentifier. Then, either:Each word after the identifier will ...

2019-07-31 18:27:32 135

原创 leetcode 819. Most Common Word 的思路与python实现

Given a paragraphand a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is at least one word that isn't banned, and that the answer...

2019-07-31 17:38:21 206

原创 leetcode 763. Partition Labels 的思路与python实现

A stringSof lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers representing th...

2019-07-28 01:09:12 215

原创 leetcode 92. Reverse Linked List II 的思路与python实现

Reverse a linked list from positionmton. Do it in one-pass.Note:1 ≤m≤n≤ length of list.Example:Input: 1->2->3->4->5->NULL, m = 2, n = 4Output: 1->4->3->2->5-...

2019-07-27 22:41:15 167

原创 leetcode 116 & 117. Populating Next Right Pointers in Each Node 的思路与python实现

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-07-27 16:34:19 110

原创 leetcode 670. Maximum Swap 的思路与python实现

Given a non-negative integer, you could swap two digitsat mostonce to get the maximum valued number. Return the maximum valued number you could get.Input: 2736Output: 7236Explanation: Swap the ...

2019-07-05 17:54:19 482

原创 leetcode 155. Min Stack 的思路与python实现

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack.pop() – Removes the element on top of the stack.top() – Get the...

2019-07-02 17:12:52 127

原创 JavaScript30之15 – LocalStorage和事件委托

因为使用了LocalStorage,添加的items再刷新后仍会保留。这个教程挺好,很多我想了解的概念都出现了。localStorage特性 Cookie localStorage sessionStorage 数据的生命期 一般由服务器生成,可设置失效时间。如果在浏览器端生成Cookie,默认是关闭浏览器后失效 除非被清除,否则永久保存 仅在当...

2019-06-14 00:33:57 163

原创 JavaScript30之13 – 在滚动时滑入

图片在滚动到时才浮现,这是一个除了酷炫没有什么卵用的功能。感觉挺高大上的,其实主要就是运用了窗口和元素的各种长度。本项目中用到的:window.scrollY : 当前垂直滚动的像素数window.innerHeight : 浏览器窗口的文档显示区的高度和宽度element .offsetTop : 元素的垂直偏移位置element.offsetHeight:图片元...

2019-06-14 00:26:33 93

原创 JavaScript30之11 – 定制播放器

一, 箭头函数中的this。 箭头函数的this的绑定取决于外层(函数或全局)作用域。 这次真碰上了,没注意就出Bug了。改为使用function创建函数。二, 这个项目主要是了解HTML5中的<video>相关的属性和事件。http://www.w3school.com.cn/jsref/dom_obj_event.aspDOM video对象的属性和方法:http://...

2019-06-14 00:24:42 128

转载 好消息!现已可以通过https安全访问liust.me

(我的原wordpress域名为liust.me,不过最近在转移该博客上的内容到CSDN上,包括本文在内的内容是从该博客上转移而来)liust.me一直致力于给用户安全、尊重隐私的网络冲浪体验。现本站已经和由Mozilla、Cisco、Akamai、IdenTrust、EFF等组织人员发起 Let’s Encript 项目达成合作,用户从即刻起可以使用更安全的https协议访问本站。访...

2019-06-14 00:23:33 1932

原创 JavaScript30之09 – 开发者工具

console的各种用法,一目了然 const dogs = [{ name: 'Snickers', age: 2 }, { name: 'hugo', age: 8 }]; function makeGreen() { const p = document.querySelector('p'); p.style.color = '#BADA55';...

2019-06-13 23:32:03 95

原创 JavaScript30之08 – 快乐的HTML5 Canvas

实现点击绘画功能。监听到mousemove时调用draw。isDrawing决定调用draw时是否绘画。监听mouseup和mouseout来维护isDrawing。在draw中绘制路径时,路径的起始点为lastX, lastY。mousedown的位置或者是上一次路径的结尾。终点为mousemove时间的e.offsetX, e.offsetY。 <can...

2019-06-13 23:30:52 104

原创 JavaScript30之06 – 检索

JavaScriptfetch(url),返回一个promise对象。XMLHttpRequest的替代方法。/* 获取json的方法 */let cities = [];fetch('gist.githubusercontent.com/.../cities.json') .then(blob => blob.json()) .then(data =&gt...

2019-06-13 23:10:47 122

原创 JavaScript30之04 – Flex酷炫相册

主要是学习理解flex。.panels {min-height: 100vh; /* 高度为浏览器视窗高度 */overflow: hidden; /* 隐藏scrollbar */display: flex;}.panel {background: #6B0F9C;box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0...

2019-06-13 22:15:04 123

转载 ES6新特性

原文https://www.cnblogs.com/libin-1/p/6716470.html一、新的变量声明方式 let/const块级作用域与不再具备变量提升。二、 箭头函数的使用三、模板字符串// es6const a = 20;const b = 30;const string = `${a}+${b}=${a+b}`;四、 解析结构类似pyth...

2019-06-13 22:12:52 77

原创 Javascript30之03 – 图片变变变(CSS变量)

从这个项目的教学视频学会一个新的英语短语:smart alec – 自作聪明的人。从图片可以看出这个项目就是一个可以调整三个参数对图片进行处理的网页,主要是为了介绍CSS原生的变量。CSS中原生的变量定义语法是:--*,变量使用语法是:var(--*)。这也太麻烦了吧:root 是根选择器,其实也就是选择<html>。在根上定义这几个CSS变量,就可以全局使用了。...

2019-06-13 22:10:57 425

原创 JavaScript30 之02 – 时钟

.clock { width: 30rem; height: 30rem; border: 20px solid white; border-radius: 50%; /*圆角半径为边的一半的正方形,就是圆了。*/ margin: 50px auto; position: relative; /* 设为relat...

2019-06-13 22:07:42 154

原创 JavaScript30 之01 – 架子鼓

JavaScript30是30天每天用原生JavaScript完成一个网页项目的挑战,附有免费的视频教程。 (https://javascript30.com/)无意间在网上看到,觉得很有趣,就开始了。在这里记录一下过程中涉及到的自己不熟悉的内容吧。01 – JavaScript Drum KitHTML5中添加了data-*的方式来自定义属性,所谓data-*实际上上就是data-...

2019-06-13 22:05:23 200

原创 Leetcode 《3. 无重复字符的最长子串》 之Python实现

给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。示例 1:输入: "abcabcbb"输出: 3 解释: 因为无重复字符的最长子串是"abc",所以其长度为 3。示例 2:输入: "bbbbb"输出: 1解释: 因为无重复字符的最长子串是"b",所以其长度为 1。示例 3:输入: "pwwkew"输出: 3解释: 因为无重复字符的最长子串...

2018-12-22 00:57:25 108

原创 Leetcode 《2. 两数相加》 之JS实现

准备面试,临时抱佛脚地开始刷leetcode,顺便练习一下javascript,决定把过程放博客记录一下,主要是总结比较个人的问题,大家可以不看。题目《2. 两数相加》给出两个 非空 的链表用来表示两个非负的整数。其中,它们各自的位数是按照 逆序 的方式存储的,并且它们的每个节点只能存储 一位 数字。如果,我们将这两个数相加起来,则会返回一个新的链表来表示它们的和。您可以假设除了...

2018-12-01 02:28:39 1479 1

原创 React当中,为什么明明调用了setState(),state也发生了变化,就是没有重新渲染,更新界面?

以前没用过react,改别人的代码,发生了这个问题。原来是原代码中有shouldComponentUpdate(nextProps, nextState)这个方法。这个方法会判断发生什么样的state改变才进行重新渲染。return true的时候重新渲染,false则不变。详情可自行搜索。...

2018-06-10 15:07:24 22956 1

原创 解答:C语言中结构体的定义中,后面跟的“结构体变量”到底是什么?

这个问题我在网上没看到很清楚的回答,w3cschool里也没讲清楚,所以就整理了一下自己的理解,回答了一个百度知道的提问。贴上链接:https://zhidao.baidu.com/question/557784323.html?hideOtherAnswer=true&amp;newAnswer=1)把答案附如下,如有问题请指教// 情况一:student作为结构体的标识符 常规操作 stru...

2018-05-14 09:47:06 8580 2

原创 Ubuntu开机卡在boot横杠界面/显示(显卡驱动问题引起的)

这学期要用Linux,我本来装win10/Ubuntu双系统,不过不知道为什么,本来好好的,用着用着,突然有天就开机卡在了右上角有个横杠一闪一闪的界面。重装了两次,都是同样的结果。于是删了改用虚拟机,后来也是进不去,显示一个“The system is running in low-graphics mode”的窗口。(我不确定这两种结果是不是因为同一个原因,暂且认为是吧)看来这个问题再重装也解决...

2018-03-16 22:13:49 6322

空空如也

空空如也

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

TA关注的人

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