- 博客(27)
- 资源 (7)
- 收藏
- 关注
原创 Weekly Contest 73 leetcode 790. Domino and Tromino Tiling
We have two types of tiles(地砖): a 2x1 domino shape, and an "L" tromino shape. These shapes may be rotated.XX <- dominoXX <- "L" trominoXGiven N, how many ways are there to tile a 2 x N boa
2018-02-25 16:37:05 594
原创 Weekly Contest 73 leetcode 791. Custom Sort String
S and T are strings composed of lowercase letters. In S, no letter occurs more than once.S was sorted in some custom order previously. We want to permute the characters of T so that they match
2018-02-25 14:57:04 573
原创 Weekly Contest 73 leetcode 789. Escape The Ghosts
You are playing a simplified Pacman game. You start at the point (0, 0), and your destination is (target[0], target[1]). There are several ghosts on the map, the i-th ghost starts at (ghosts[i][0]
2018-02-25 14:17:07 380
原创 Weekly Contest 73 leetcode 788. Rotated Digits
X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. A number is valid if each digit remains a digit after rotation. 0, 1, and 8
2018-02-25 13:36:09 1015 1
转载 红黑树详解
二叉搜索树是个很好的数据结构,可以快速地找到一个给定关键字的数据项,并且可以快速地插入和删除数据项。但是二叉搜索树有个很麻烦的问题,如果树中插入的是随机数据,则执行效果很好,但如果插入的是有序或者逆序的数据,那么二叉搜索树的执行速度就变得很慢。因为当插入数值有序时,二叉树就是非平衡的了,排在一条线上,其实就变成了一个链表……它的快速查找、插入和删除指定数据项的能力就丧失了。 为了
2018-02-23 20:24:25 251
转载 web开发中web容器的作用(如tomcat)
我们讲到servlet可以理解服务器端处理数据的java小程序,那么谁来负责管理servlet呢?这时候我们就要用到web容器。它帮助我们管理着servlet等,使我们只需要将重心专注于业务逻辑。什么是web容器?servlet没有main方法,那我们如何启动一个servlet,如何结束一个servlet,如何寻找一个servlet等等,都受控于另一个java应用,这个应用我们
2018-02-22 21:10:22 2429
转载 javascript中常用的创建对象的方法
js中创建对象最简单的方法自然是直接new一个Object然后再为其添加属性和方法,例如一下代码:12345var o = new Object();o.name = "aaaa";o.sayName = function() { alert(this.name);}但这样显然封装性太差,属性和方法分布在各个
2018-02-22 16:25:59 298
转载 浅谈javascript中的回调函数
要理解javascript中的回调函数,首先我们就要对javascript中的函数有一定的理解,所以我们先从javascript中函数谈起,讲讲它与其他语言中的函数有什么不同。javascript中的函数在javascript中,函数也是一种data,一种数据,只不过这种数据比较特殊,它里面存的是代码,而且这种data可以被调用执行。自然,因为函数也是数据,所以就可以赋
2018-02-22 16:10:29 276
转载 浅谈javascript中的的闭包
闭包可以说是javascript中最令人迷惑的概念了。需要我们在实践中去慢慢理解,在实际编码中,由于闭包的效率和会产生大量无法销毁的内存,所以原则是尽量少使用闭包,但是作为javascript中的一个特别的概念,理解闭包是很重要的。闭包像是一种突破javascript中作用域限制的利剑。下面我们就从javascript中的作用域链谈起,简单讲讲闭包的概念和理解。作用域链java
2018-02-22 15:48:18 252
转载 深入理解javascript中的原型
原型prototype是javascript中极其重要的概念之一,但也是比较容易引起混淆的地方。我们需要花费一些时间和精力好好理解原型的概念,这对于我们学习javascript是必须的。原型的概念真正理解什么是原型是学习原型理论的关键。很多人在此产生了混淆,没有真正理解,自然后续疑惑更多。首先,我们明确原型是一个对象,其次,最重要的是,Every functio
2018-02-22 15:34:06 209
转载 TCP/IP之路由算法
网络层的重要功能就是路由和转发。而路由是根据路由器根据所维护的路由表进行路由选择。所以,如果创建和更新转发表就是一个很重要的问题。通常,在路由时,我们总是选取所需代价最小的一条路由。首先,我们需要将网络进行抽象,最常见的抽象就是,将网络抽象成图结构。每段链路的费用可以总是1,或者是,带宽的倒数、拥塞程度等。关键问题: 源到目的(如u到z)的最小费用路径是什么
2018-02-21 20:45:54 3251
转载 一篇文章搞懂leetcode位操作算法题
本文将根据题目总结常用的位操作常用的解决算法问题的技巧Single Number落单的数给出2*n + 1 个的数字,除其中一个数字之外其他每个数字均出现两次,找到这个数字。思路:一个数字和自己进行异或操作会是0,由于异或操作满足交换定律,一个数和0进行异或操作还是本身。所以这道题目的思路就来了,将所有出现两次的数异或就都变成了0,最后剩的那个数和0异或就还是本
2018-02-21 19:27:00 1273
转载 深入理解Spring框架的作用
纵览Spring , 读者会发现Spring 可以做非常多的事情。 但归根结底, 支撑Spring的仅仅是少许的基本理念, 所有的理念都可以追溯到Spring最根本的使命上: 简化Java开发。Spring的目标是致力于全方位的简化Java开发。 这势必引出更多的解释, Spring是如何简化Java开发的?为了降低Java开发的复杂性, Spring采取了以下4种关键策略:
2018-02-20 20:15:24 39467 9
转载 深入解析Java垃圾回收机制
引入垃圾回收哪些内存需要回收?引用计数法可达性分析如何回收Marking 标记Normal Deletion 清除Deletion with Compacting 压缩为什么需要分代收集?JVM的分代新生代老年代永久代分代垃圾收集过程详述引入垃圾回收程序计数器、 虚拟机栈、 本地方法栈3个区域随线程而生,随线程而灭;栈中的栈帧随着
2018-02-20 18:19:36 250
原创 Weekly Contest 72 leetcode 786. K-th Smallest Prime Fraction
A sorted list A contains 1, plus some number of primes. Then, for every p < q in the list, we consider the fraction p/q.What is the K-th smallest fraction considered? Return your answer as an
2018-02-18 20:09:27 792
原创 Weekly Contest 72 leetcode 787. Cheapest Flights Within K Stops
There are n cities connected by m flights. Each fight starts from city u and arrives at v with a price w.Now given all the cities and fights, together with starting city src and the destinatio
2018-02-18 16:58:06 853
原创 Weekly Contest 72 leetcode 785. Is Graph Bipartite?
Given a graph, return true if and only if it is bipartite.Recall that a graph is bipartite if we can split it's set of nodes into two independent subsets A and B such that every edge in the grap
2018-02-18 14:22:35 852
原创 Weekly Contest 72 leetcode 784. Letter Case Permutation
Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible strings we could create.Examples:Input: S = "a1b2"
2018-02-18 13:45:27 532
原创 Weekly Contest 71 leetcode 782. Transform to Chessboard
An N x N board contains only 0s and 1s. In each move, you can swap any 2 rows with each other, or any 2 columns with each other.What is the minimum number of moves to transform the board into
2018-02-11 15:46:56 1138
原创 Weekly Contest 71 leetcode 780. Reaching Points
A move consists of taking a point (x, y) and transforming it to either (x, x+y) or (x+y, y).Given a starting point (sx, sy) and a target point (tx, ty), return True if and only if a sequence o
2018-02-11 15:12:46 1072
原创 Weekly Contest 71 leetcode 781. Rabbits in Forest
In a forest, each rabbit has some color. Some subset of rabbits (possibly all of them) tell you how many other rabbits have the same color as them(告诉你 有多少只其他兔子跟它颜色一样). Those answers are placed in an
2018-02-11 14:46:24 839
原创 Weekly Contest 71 leetcode 783. Minimum Distance Between BST Nodes
Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree.Example :Input: root = [4,2,6,1,3,null,null]O
2018-02-11 14:11:36 342
原创 leetcode 54. Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]You
2018-02-10 23:31:46 171
原创 Weekly Contest 70 leetcode 778. Swim in Rising Water
On an N x N grid, each square grid[i][j] represents the elevation(高度) at that point (i,j).Now rain starts to fall. At time t, the depth of the water everywhere is t. You can swim from a square to anot...
2018-02-09 23:16:38 519
原创 Weekly Contest 70 leetcode 777. Swap Adjacent in LR String
In a string composed of 'L', 'R', and 'X' characters, like "RXXLRXRXL", a move consists of either replacing one occurrence of "XL" with "LX", or replacing one occurrence of "RX" with "XR". Giv
2018-02-04 22:36:58 412
原创 Weekly Contest 70 leetcode 779. K-th Symbol in Grammar
On the first row, we write a 0. Now in every subsequent row, we look at the previous row and replace each occurrence of 0 with 01, and each occurrence of 1 with 10.Given row N and index K, r
2018-02-04 18:40:36 761
转载 算法-求二进制数中1的个数
问题描述任意给定一个32位无符号整数n,求n的二进制表示中1的个数,比如n = 5(0101)时,返回2,n = 15(1111)时,返回4这也是一道比较经典的题目了,相信不少人面试的时候可能遇到过这道题吧,下面介绍了几种方法来实现这道题,相信很多人可能见过下面的算法,但我相信很少有人见到本文中所有的算法。如果您上头上有更好的算法,或者本文没有提到的算法,请不要吝惜您的代码,分享的时候
2018-02-03 14:42:22 234
[数学建模方法与分析].(新西兰)Mark.M.Meerschaert.清晰PDF版
2017-09-15
有名的combobox下拉框插件压缩后的js版本
2016-09-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人