- 博客(19)
- 收藏
- 关注
转载 html中脚本的执行顺序
刚接触JavaScript,对于脚本放在html源码中的不同位置,执行顺序不太了解,做了个实验,贴出结果,记录下来以后用得着。测试代码,如下:http://www.w3.org/TR/html4/strict.dtd"> 测试js执行顺序 alert('defer里的内容') alert('hea
2016-06-27 11:17:01 850
原创 jQuery之$(document)
$(document)是一个选择器,选中的是整个html所有元素的集合。 $(document).ready()里面的元素或事件都将会在DOM完成加载之后立即加载,并且在页面内容加载之前。 使用 $(document).ready(),你能让你的事件在window加载之前加载或触发。所有你写在这个方法里面的都准备在最早的时刻加载或触发。也就是说,一旦DOM在浏览器中注
2016-06-24 11:11:33 21088
转载 Word Break(medium)
【题目】Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["l
2016-06-24 09:40:54 322
转载 Sort Colors
【题目】Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the int
2016-06-20 17:27:52 434
原创 Word Search
【题目】 Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or ver
2016-06-20 09:30:40 471
转载 3Sum (medium)
【题目】Given an array S of n integers, are there elementsa, b, c in S such that a + b +c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not c
2016-06-07 09:50:08 213
转载 Two Sum(easy)
【题目】Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:Given nu
2016-06-07 09:32:16 211
原创 Spiral Matrix(medium)
【题目】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 ]
2016-06-06 15:27:44 247
原创 Merge Sorted Array(easy)
【题目】 Given 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 tom + n)
2016-06-06 15:02:54 260
原创 Remove Element(easy)
【题目】 Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you must do this in place with constant m
2016-06-06 09:29:42 212
原创 Search in Rotated Sorted Array(hard)
【题目】 Suppose a sorted array 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 are given a target value to search. If found in the arra
2016-06-03 16:09:50 255
原创 Search Insert Position(medium)
【题目】Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the
2016-06-03 11:25:17 241
原创 Sqrt(x)
【题目】 Implement int sqrt(int x).Compute and return the square root of x.【题意】 实现x的平方根函数【分析】 二分搜索【实现】public class Solution { public int mySqrt(int x) { d
2016-06-02 16:32:10 5940
转载 java集合类深入分析之PriorityQueue
PriorityQueue介绍 在平时的编程工作中似乎很少碰到PriorityQueue(优先队列) ,故很多人一开始看到优先队列的时候还会有点迷惑。优先队列本质上就是一个最小堆。前面一篇文章介绍了堆排序和堆的性质。而堆又是什么呢?它是一个数组,不过满足一个特殊的性质。我们以一种完全二叉树的视角去看这个数组,并用二叉树的上下级关系来映射到数组上面。如果是最大堆,则二叉树的顶点是保存的最大
2016-06-02 15:37:45 345
原创 Search for a Range(medium)
【题目】 Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not
2016-06-02 10:09:31 295
原创 Search a 2D Matrix(medium)
【题目】Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer o
2016-06-02 09:46:33 237
原创 Remove Nth Node From End of List(easy)
【题目】 Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node fro
2016-06-01 18:00:15 235
转载 Swap Nodes in Pairs(easy)
【题目】Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constan
2016-06-01 17:37:11 257
原创 Insertion Sort List(medium)
【题目】 Sort a linked list using insertion sort.【题意】 在链表中实现插入排序【分析】 传统数组版本做法就是两重循环,第一重是遍历所有元素,第二重是遍历已排序部分进行插入。对链表进行插入排序的正确方法是:新建一个头节点,遍历原来的链表,对原链表的每个节点找到新链表中适合插入位置的前指针,然后执行插入操作。
2016-06-01 16:53:53 264
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人