自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 springMVC

springMVC核心是servlet 把不同的url分配给不同的处理器,最后jsp渲染完成之后给前端用户 渲染就是拆除jsp的标签用真正的实际内容填充之在 web.xml里面配置springMVC 我们知道,servlet配置后是拦截对应的请求进行处理 那么springMVC作为一个整体就是拦截所有的请求URL 大致这么理解吧,进行处理 就是配置的奥秘入门程序...

2019-05-31 16:01:48 134

转载 Leetcode 题解 - 动态规划-数组区间(8):数组区间和

[LeetCode] Range Sum Query - Immutable 区域和检索 - 不可变Given an integer arraynums, find the sum of the elements between indicesiandj(i≤j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -...

2019-05-31 11:23:14 756

转载 Leetcode 题解 - 动态规划-斐波那契数列(4-5):信件错排,母牛生产

信件错排题目描述:有 N 个 信 和 信封,它们被打乱,求错误装信方式的数量。定义一个数组 dp 存储错误方式数量,dp[i] 表示前 i 个信和信封的错误方式数量。假设第 i 个信装到第 j 个信封里面,而第 j 个信装到第 k 个信封里面。根据 i 和 k 是否相等,有两种情况:i==k,交换 i 和 k 的信后,它们的信和信封在正确的位置,但是其余 i-2 封信有 dp[i-2]...

2019-05-31 11:04:42 3000

转载 Leetcode 题解 - 动态规划-矩阵路径(7):矩阵的总路径数

[LeetCode] Unique Paths 不同的路径A 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. T...

2019-05-31 11:04:35 996

转载 Leetcode 题解 - 动态规划-矩阵路径(6):矩阵的最小路径和

[LeetCode] Minimum Path Sum 最小路径和Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:You c...

2019-05-31 10:49:13 915

转载 Leetcode 题解 - 动态规划-斐波那契数列(1): 爬楼梯

Climbing StairsYou are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note:Givennw...

2019-05-31 10:35:51 300

转载 Leetcode 题解 - 动态规划-斐波那契数列(3):强盗在环形街区抢劫

[LeetCode] House Robber II 打家劫舍之二You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place arearranged in a ...

2019-05-31 10:35:31 649

转载 Leetcode 题解 - 动态规划-斐波那契数列(2):强盗抢劫

[LeetCode] House Robber 打家劫舍You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing ea...

2019-05-31 10:09:37 393

转载 Leetcode 题解 - 搜索--Backtracking(21):分割字符串使得每个部分都是回文数

[LeetCode] Palindrome Partitioning 拆分回文串Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.Example:In...

2019-05-29 11:33:01 348

转载 Leetcode 题解 - 搜索--Backtracking(20):含有相同元素求子集

[LeetCode] Subsets II 子集合之二Given a collection of integers that might contain duplicates,S, return all possible subsets.Note:Elements in a subset must be in non-descending order. The solutio...

2019-05-28 15:46:41 116

转载 Leetcode 题解 - 搜索--Backtracking(19):子集合

[LeetCode] Subsets 子集合Given a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order. The solution set must not contain duplicate ...

2019-05-28 11:33:19 106

转载 Leetcode 题解 - 搜索--Backtracking(17):1-9 数字的组合求和

Find all possible combinations ofknumbers that add up to a numbern, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Ensure that numbers with...

2019-05-28 11:10:19 182

转载 Leetcode 题解 - 搜索--Backtracking(16):组合求和

[LeetCode] Combination Sum 组合之和Given asetof candidate numbers (candidates)(without duplicates)and a target number (target), find all unique combinations incandidateswhere the candidate numb...

2019-05-27 16:49:16 103

转载 Leetcode 题解 - 搜索--Backtracking(15):组合

[LeetCode] Combinations 组合项Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3]...

2019-05-27 16:31:32 137

转载 Leetcode 题解 - 搜索--Backtracking(14):全排列2

[LeetCode] Permutations II 全排列之二Given a collection of numbers that might contain duplicates, return all possible unique permutations.Example:Input: [1,1,2]Output:[ [1,1,2], [1,2,1], ...

2019-05-27 11:35:27 163

转载 Leetcode 题解 - 搜索--Backtracking(13):Permutations 全排列

[LeetCode] Permutations 全排列Given a collection ofdistinctintegers, return all possible permutations.Example:Input: [1,2,3]Output:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], ...

2019-05-27 11:25:49 167

转载 Leetcode 题解 - 搜索--Backtracking(12):输出二叉树中所有从根到叶子的路径

[LeetCode] Binary Tree Paths 二叉树路径Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:...

2019-05-27 10:41:04 233

转载 Leetcode 题解 - 搜索--Backtracking(11):在矩阵中寻找字符串

[LeetCode] 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 th...

2019-05-27 10:07:07 500

转载 Leetcode 题解 - 搜索--Backtracking(10):IP 地址划分

[LeetCode] Restore IP Addresses 复原IP地址Given a string containing only digits, restore it by returning all possible valid IP address combinations.Example:Input: "25525511135"Output: ["255.255...

2019-05-24 11:24:05 531

转载 Leetcode 题解 - 搜索--BFS(1):计算在网格中从原点到特定点的最短路径长度

深度优先搜索和广度优先搜索广泛运用于树和图中,但是它们的应用远远不止如此。BFS广度优先搜索一层一层地进行遍历,每层遍历都以上一层遍历的结果作为起点,遍历一个距离能访问到的所有节点。需要注意的是,遍历过的节点不能再次被遍历。第一层:0 -> {6,2,1,5}第二层:6 -> {4} 2 -> {} 1 -> {} 5 -> {3...

2019-05-22 20:40:53 1797

转载 Java集合详解1:ArrayList,Vector与Stack

本文非常详尽地介绍了Java中的三个集合类ArrayList,Vector与Stack”Java集合详解系列“是我在完成Java基础篇的系列博客后准备开始写的新系列。Java集合系列专栏地址:https://blog.csdn.net/column/details/21877.html之前的Java基础系列博客首发于我的个人博客:https://h2pl.github.io/在这...

2019-05-21 16:47:34 110

转载 Leetcode 题解 --二分查找--查找区间

[LeetCode] Search for a Range 搜索一个范围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 ofO...

2019-05-21 10:37:02 554

转载 Leetcode 题解 --二分查找--旋转数组的最小数字

旋转数组的最小数字153. Find Minimum in Rotated Sorted Array (Medium)Input: [3,4,5,1,2],Output: 1直接写法:class Solution { public int findMin(int[] nums) { for(int i=1; i < nums.length; i+...

2019-05-20 15:07:06 577

转载 Leetcode 题解 --二分查找--第一个错误的版本

278. First Bad Version (Easy)题目描述:给定一个元素 n 代表有 [1, 2, ..., n] 版本,在第 x 位置开始出现错误版本,导致后面的版本都错误。可以调用 isBadVersion(int x) 知道某个版本是否错误,要求找到第一个错误的版本。如果第 m 个版本出错,则表示第一个错误的版本在 [l, m] 之间,令 h = m;否则第一个错误的版本在...

2019-05-20 14:24:39 155

转载 Leetcode 题解 --二分查找--有序数组的 Single Element

[LeetCode] Single Element in a Sorted Array 有序数组中的单独元素Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this singl...

2019-05-20 14:11:15 459

转载 Leetcode 题解 --二分查找--大于给定元素的最小元素

大于给定元素的最小元素744. Find Smallest Letter Greater Than Target (Easy)Input:letters = ["c", "f", "j"]target = "d"Output: "f"Input:letters = ["c", "f", "j"]target = "k"Output: "c"题目描述:给...

2019-05-20 11:04:32 762

转载 Leetcode 题解 -- 二分查找-- 求开方

正常实现Input : [1,2,3,4,5]key : 3return the index : 2public int binarySearch(int[] nums, int key) { int l = 0, h = nums.length - 1; while (l <= h) { int m = l + (h - l) / 2; ...

2019-05-20 10:34:41 523

转载 Leetcode 题解 -- 贪心--分隔字符串使同种字符出现在一起

分隔字符串使同种字符出现在一起763. Partition Labels (Medium)Input: S = "ababcbacadefegdehijhklij"Output: [9,7,8]Explanation:The partition is "ababcbaca", "defegde", "hijhklij".This is a partition so that...

2019-05-20 10:03:07 945

转载 Leetcode 题解 -- 贪心--子数组最大的和

子数组最大的和Given an integer arraynums, find the contiguous subarray(containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],Output: 6...

2019-05-19 19:58:02 300

转载 Leetcode 题解 -- 贪心--修改一个数成为非递减数组

修改一个数成为非递减数组665. Non-decreasing Array (Easy)Input: [4,2,3]Output: TrueExplanation: You could modify the first 4 to 1 to get a non-decreasing array.题目描述:判断一个数组是否能只修改一个数就成为非递减数组。就看这个例子[3,4,2,...

2019-05-19 19:46:48 1124 1

转载 Leetcode 题解 -- 贪心--买卖股票最大的收益

买卖股票最大的收益121. Best Time to Buy and Sell Stock (Easy)题目描述:只进行一次交易。只要记录前面的最小价格,将这个最小价格作为买入价格,然后将当前的价格作为售出价格,查看当前收益是不是最大收益。class Solution { public int maxProfit(int[] prices) { if(pr...

2019-05-17 11:27:32 2153

转载 Leetcode 题解 -- 贪心--根据身高和序号重组队列

根据身高和序号重组队列406. Queue Reconstruction by Height(Medium)Input:[[7,0], [4,4], [7,1], [5,0], [6,1], [5,2]]Output:[[5,0], [7,0], [5,2], [6,1], [4,4], [7,1]]题目描述:一个学生用两个分量 (h, k) 描述,h 表示身高,k ...

2019-05-17 10:41:00 948

转载 Leetcode 题解 -- 贪心--投飞镖刺破气球

投飞镖刺破气球452. Minimum Number of Arrows to Burst Balloons (Medium)相比较上一个题调整了start的位置 因为start只有在前一堆重叠的气球里面不在有效了 人就换成下一个气球所在的区间Input:[[10,16], [2,8], [1,6], [7,12]]Output:2题目描述:气球在一个水平数轴上摆...

2019-05-17 10:09:37 739

转载 Leetcode 题解 -- 贪心--不重叠的区间个数

不重叠的区间个数这个题问的是去掉几个才能满足不重叠区间的条件还要设置一个start 满足后 start 就等于当前i435. Non-overlapping Intervals (Medium)Input: [ [1,2], [1,2], [1,2] ]Output: 2Explanation: You need to remove two [1,2] to ma...

2019-05-16 20:26:41 1192

转载 Leetcode 题解 -- 贪心--分配饼干

分配饼干455. Assign Cookies (Easy)Input: [1,2], [1,2,3]Output: 2Explanation: You have 2 children and 3 cookies. The greed factors of 2 children are 1, 2.You have 3 cookies and their sizes are big...

2019-05-16 19:30:18 286

转载 Leetcode 题解 -- 排序--桶排序

[LeetCode] Top K Frequent Elements 前K个高频元素相当于组成了个Given a non-empty array of integers, return thekmost frequent elements.Example 1:Input: nums = [1,1,1,2,2,3], k = 2Output: [1,2]Example ...

2019-05-16 19:10:26 308

转载 Leetcode 题解 -- 排序--快速选择

快速选择用于求解Kth Element问题,也就是第 K 个元素的问题。可以使用快速排序的 partition() 进行实现。需要先打乱数组,否则最坏情况下时间复杂度为 O(N2)。堆用于求解TopK Elements问题,也就是 K 个最小元素的问题。可以维护一个大小为 K 的最小堆,最小堆中的元素就是最小元素。最小堆需要使用大顶堆来实现,大顶堆表示堆顶元素是堆中最大元素...

2019-05-16 10:16:54 378

转载 Leetcode 题解 -- 排序--荷兰国旗问题

荷兰国旗问题1.暴力解法 记录每个的个数2. 双指针 中间的荷兰国旗包含三种颜色:红、白、蓝。有三种颜色的球,算法的目标是将这三种球按颜色顺序正确地排列。它其实是三向切分快速排序的一种变种,在三向切分快速排序中,每次切分都将数组分成三个区间:小于切分元素、等于切分元素、大于切分元素,而该算法是将数组分成三个区间:等于红色、等于白色、等于蓝色。按颜色进行排序7...

2019-05-16 10:16:43 1929

转载 Leetcode 题解 - 双指针

1. Kth Element用小顶堆的话 按顺序存在队列中 队列开头是最小的元素 然后依次加入到序列末尾位置 这是自然排序后的结果大顶堆就需要一个Comparator的比较器 反过来就好peek poll操作都是对头元素的操作add是添加到末尾的操作所以小顶对实现这个题 就是现存k个 大于k个的时候就不断取出头元素 这样剩下k个最大的元素 头元素就是第K大的值215...

2019-05-15 20:57:21 141

原创 web12 Js原生Ajax和Jquery的Ajax

中间设置了暂停5秒 点异步之后 再过五秒出现结果 中间可以点测试点同步后过五秒出现结果但是中间点测试没用 五秒之后就可以出现结果了ajax还能实现局部刷新 就是只改变客户端局部一些内容...

2019-05-14 22:27:43 103

空空如也

空空如也

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

TA关注的人

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