- 博客(30)
- 收藏
- 关注
原创 浏览器缓存--协商缓存
当浏览器对某个资源的请求没有命中强缓存,就会发一个请求到服务器,验证协商缓存是否命中,如果协商缓存命中,请求响应返回的http状态为304并且会显示一个Not Modified的字符串,比如你打开头条号的首页,打开开发者工具,再刷新页面,查看network,可以看到有不少请求就是命中了协商缓存。查看单个请求的ResponseHeader,也能看到304的状态码和Not Modified的字符串,只要
2016-03-10 23:39:55
766
转载 强缓存引起问题解决方案
存在的问题:发布时资源更新问题,更新了资源,但是用户每次请求时依然从缓存中获取原来的资源,除非用户清掉或者强刷新,否则看不到最新的效果。 通常我们写页面直接放到服务器上,等待用户访问,那么每次用户访问页面都需要重新加载例如css文件等静态资源,十分影响性能,浪费带宽。于是第一个解决办法: 1、利用304定向重定向,让浏览器本地缓存即协商缓存。 缺点:协商缓存还是需要和浏览器通信一次
2016-03-06 23:42:00
2752
原创 浏览器缓存--阅读笔记
一、浏览器缓存强缓存:浏览器在请求资源时,会根据请求的http header判断是否是强缓存,如果是强缓存,会直接从浏览器中读取资源,不会向服务器发送请求;协商缓存:如果不是强缓存,浏览器就发送请求到服务器,通过服务器端依据请求资源的http header看是否是协商缓存,如果是浏览器就会将这个请求返回,但是返回内容中没有数据,而是告诉客户端可以直接从缓存中加载资源,最终浏览器从自己的缓存中加载
2016-03-06 00:21:14
464
原创 2015年总结
时间总是过得太快,感觉还没做些什么,2015从指间溜走了~~写个小总结,希望对比2016年,能够更好,更加珍惜时间,做对的事,成为更优秀的人。 -----By LJM1月-5月回忆起来,前五个月感觉并未做过什么,想想很恐慌,浪费了那么多时间。但是这五个月是有意义的。让我真正意识到了实验室的情况,更加清晰未来自己要做什么,想清楚了自己要什么。醒悟有点晚,
2016-01-01 10:15:50
331
原创 Leetcode 第278题 First Bad Version
题目:First Bad VersionYou are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is de
2015-12-25 22:52:17
240
原创 Leetcode 第268题Missing Number
题目:Missing NumberGiven an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.For example, Given nums = [0, 1, 3] return 2.Note: Your algorithm
2015-12-20 20:58:37
361
原创 Leetcode 第290题Word Pattern
题目:Word PatternGiven a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in
2015-12-10 23:35:49
289
原创 Leetcode 第6题ZigZag Conversion
题目:ZigZag ConversionThe string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A
2015-12-10 23:18:30
317
原创 Leetcode 第2题Add Two Numbers
题目:Add Two NumbersYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and r
2015-12-10 23:08:50
426
原创 Leetcode 第12题Integer to Roman
题目:Integer to RomanGiven an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.题目分析:题目的含义是将1到3999的数字转换为对应的罗马符号思路:根据罗马符号的特点和数字表达的特点,建立一个数字将0到9;10到90;10
2015-12-08 23:37:56
511
原创 Leetcode 第13题Roman to Integer
题目:Roman to IntegerGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.题目含义:将罗马符号转换为对应数字大小的整型数字思路:对于罗马符号I代表的是1;V代表的是5;X代表的是10;L代表的是50;C代表的是10
2015-12-08 23:30:10
362
原创 Leetcode 第119题 Pascal's Triangle II
题目:Pascal’s Triangle IIGiven an index k, return the kth row of the Pascal’s triangle.For example, given k = 3, Return [1,3,3,1].Note: Could you optimize your algorithm to use only O(k) extra space?
2015-12-03 23:38:03
219
原创 Leetcode 第118题 Pascal's Triangle
题目:Pascal’s TriangleGiven numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]] Subscribe to s
2015-12-03 23:33:06
326
原创 Leetcode 第20题 Valid Parentheses
题目:Valid ParenthesesGiven a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}
2015-12-01 20:21:41
406
原创 Leetcode 第190题 Reverse Bits
题目:Reverse BitsReverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary a
2015-12-01 16:30:56
272
原创 Leetcode 第88题 Merge Sorted Array
题目:Merge Sorted ArrayGiven two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m +
2015-12-01 15:30:59
346
原创 Leetcode 第88题 Merge Sorted Array
题目:Merge Sorted ArrayGiven two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m +
2015-12-01 15:29:56
229
原创 Leetcode 第8题 String to Integer (atoi)
题目: String to Integer (atoi)Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what a
2015-11-29 23:57:46
263
原创 Leetcode 第191题 Number of 1 Bits
题目:Number of 1 BitsWrite a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ has binary represen
2015-11-29 23:47:41
311
原创 Leetcode 第205题 Isomorphic Strings
题目:Isomorphic StringsGiven two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be rep
2015-11-29 00:24:11
386
原创 Leetcode 第228题 Summary Ranges
题目:Summary RangesGiven a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return [“0->2”,”4->5”,”7”].Credits: Special thanks to @jianchao.li
2015-11-29 00:13:15
298
原创 Leetcode 第66题 Plus One
题目:Plus OneGiven a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.题目分析:将数字放在数组中存
2015-11-29 00:03:36
743
原创 Leetcode 第232题 Implement Queue using Stacks
题目:Implement Queue using StacksImplement the following operations of a queue using stacks.* push(x) -- Push element x to the back of queue.* pop() -- Removes the element from in front of queue.* pee
2015-11-28 00:10:16
293
原创 Leetcode 第225题 Implement Stack using Queues
题目:Implement Stack using QueuesImplement the following operations of a stack using queues.push(x) – Push element x onto stack.pop() – Removes the element on top of the stack.top() – Get the top elem
2015-11-27 23:33:30
254
原创 Leetcode 第168题 Excel Sheet Column Title
题目:Excel Sheet Column TitleGiven a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA
2015-11-27 14:59:48
319
原创 Leetcode 第171题 Excel Sheet Column Number
题目:Excel Sheet Column NumberRelated to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example:A -> 1B -> 2C -> 3...Z -
2015-11-25 19:01:13
261
原创 Leetcode 第125题 Valid Palindrome
题目:Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, “A man, a plan, a canal: Panama” is a palindrome. “race
2015-11-25 17:51:26
293
原创 Leetcode 204题 Count Primes
题目 :Count PrimesCount the number of prime numbers less than a non-negative number, n.题目分析:这道题目的意思是写一函数实现找出小于n的数中有多少个质数?思路:最小的质数是2,那么所有2的倍数即偶数都不是质数。第二个质数是3,那么所有3的倍数都不是质数。第三个质数是5,那么所以5的倍数都不是质数。以此类推
2015-11-24 13:05:41
346
原创 Leetcode 231题Power of Two
Leetcode 231题Power of Two题目 Given an integer, write a function to determine if it is a power of two. 即判断一个数是否是2的次方数 —— [ Power of Two ]思路如果一个数是2的次方数,那么n用二进制表示的数只有一位上是1,其他位上都是0,例如100000,0010,0
2015-11-23 13:18:56
304
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人