自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 新增函数式接口 java.util.function

函数式接口:只有一个抽象方法的接口 JDK8之前已有的函数式接口有:Runnable、Callable、 Comparator、 InvocationHandler、 PathMatcher 。。。等等 新定义的函数式接口:java.util.function中Predicate -- 传入一个参数,返回一个bool结果, 方法为boolean test(T t)Consumer -- 传入一个参...

2018-05-09 10:09:10 220

原创 java8 stream

Java 8 中的 Stream 是对集合(Collection)对象功能的增强,它专注于对集合对象进行各种非常便利、高效的聚合操作(aggregate operation),或者大批量数据操作 (bulk dataoperation)。Stream API 借助于同样新出现的Lambda 表达式,极大的提高编程效率和程序可读性。同时它提供串行和并行两种模式进行汇聚操作,并发模式能够充分利用多核处...

2018-05-04 18:32:37 172

转载 最长公共子串 and 最长公共序列

最长公共子串和最长公共子序列。。。 举个栗子:str1="123ABCD456" str2 = "ABE12345D"最长公共子串是:123最长公共子序列是:12345 这两个都可以用动态规划,只是状态转移方程有点区别 最长公共子序列是:dp[i][j] -- 表示子串str1[0...i]和子串str[0...j]的最长公共子序列当str1[i]

2017-06-03 15:36:22 296

原创 堆排序

记录下堆排序。。。。堆排序的步骤:1)根据给定的数组建立堆结构,维护堆的性质;2)排序:每次将堆顶与最后一个元素(不算堆顶互换过来的)互换,再维护 第一个元素至最后一个元素 的堆性质,重新维护堆。。。依此循环import java.util.Arrays;public class HeapMakeTest { public static void main(Strin

2017-04-24 19:27:46 245

转载 各种常用排序的时间复杂度和稳定性以及代码实现

看到这位博主的,感觉很有用,转载记录下,声明转载地址:http://blog.csdn.net/hr10707020217/article/details/10581371怎么记忆稳定性:总过四大类排序:插入、选择、交换、归并(基数排序暂且不算)比较高级一点的(时间复杂度低一点得)shell排序,堆排序,快速排序(除了归并排序)都是不稳定的,在加上低一级的选择排序是不稳

2017-04-07 10:01:14 396

原创 剑指Offer : BST转为双向链表

输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表。要求不能创建任何新的结点,只能调整树中结点指针的指向。利用left作为双向链表的前驱指针,right作为双向链表的后驱指针,采用递归从子树开始转换。package convertBSTtoDoubleLink;class TreeNode { int val = 0; TreeNode lef

2017-03-28 21:52:00 1162

原创 2018届实习-阿里巴巴内推编程题

对于一个由一位十进制整数构成的二叉树,如果深度不超过4,可以用一个三位十进制整数构成的数组表示,具体规则如下:1、百位数表示树的层次L,12、数组里,L一定是单增的,也就是说后一个数的L大于等于前一个数的L;3、对于同一个L,P也是单增的,就是说在L不变的情况下,后一个数的P大于等于前一个数的P。例如:[ 113, 215, 221 ]      3    /

2017-03-14 21:45:24 5187 2

原创 Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.思路:找到中间节点,中间节点是BST树根,然后中间节点的 左半部分 是树根的左子树, 右半部分是树根的右子树,依次递归下去。/** * Definition for

2017-01-12 20:21:21 320

原创 Find Minimum in Rotated Sorted Array II

Suppose an array sorted in ascending order 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).Find the minimum element.The array may cont

2017-01-12 19:22:12 210

原创 Search in Rotated Sorted Array

Suppose an array sorted in ascending order 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 foun

2017-01-10 20:55:40 288

原创 Search in Rotated Sorted Array II

Suppose an array sorted in ascending order 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).Write a function to determine if a given target

2017-01-10 20:44:14 647

原创 96 Unique Binary Search Trees

Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2

2016-12-23 19:19:18 263

原创 394. Decode String

Given an encoded string, return it's decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is

2016-11-28 21:18:53 252

原创 108. Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.给定一个数组,数组中的元素是升序排好的,将它转换为高度平衡二叉检索树。高度平衡二叉检索树:任意两子树之间的深度之差不大于1.思路:类似于二分查找法,nums的中间元素(mid)为根节点,0~mi

2016-11-26 19:32:57 189

原创 216. Combination Sum III 递归的使用

Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Example 1:Inpu

2016-11-25 21:07:36 254

原创 378 Kth Smallest Element in a Sorted Matrix

给定一个每一行每一列都排好序的矩阵,求其中第k大的元素我直接暴力解法,居然被AC了!!!!!!class Solution {public: int kthSmallest(vector>& matrix, int k) { int n = matrix.size(); vector ret; for(int i=0;i<n;i++

2016-11-16 20:08:27 207

原创 46. Permutations

Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1

2016-11-07 20:04:09 210

原创 43. Multiply Strings

Given two numbers represented as strings, return multiplication of the numbers as a string.Note:The numbers can be arbitrarily large and are non-negative.Converting the input string to integ

2016-11-07 16:50:53 200

转载 Given n pairs of parentheses, write a function to generate all combinations of well-formed parenthe

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())

2016-11-03 21:19:37 1573

原创 2. Add Two Numbers

You 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 return it as a link

2016-10-31 19:40:19 226

原创 58. Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is

2016-10-12 19:32:27 202

原创 微软2017校招第一题

解题思路是采用递归,跳出条件是:两两相加不再是奇数。附上代码:#include #include using namespace std;class Solution{public: int minleng(vector &num,int n) { vector ret = myCount(num,n); return ret.s

2016-10-10 20:58:58 596 2

原创 leetcode: 9. Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.判断一个整数是不是“回文”。思路:将整数反转,然后判断两者是否相等。附上代码:#include #include using namespace std;class Solution {public:

2016-10-03 20:04:58 242

原创 leetcode:3Sum问题

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.For example, given array S = [-1, 0

2016-09-26 20:04:44 244

原创 今日头条2017校招笔试题

一些出题人出了n道题,每道题有一个难度系数,难度系数满足以下关系的3道题可以组成一套试卷,为了使这n道题使用上且只能使用一次,问出题人最少还要出多少题?ab-ac-b直接附上代码:#include #include using namespace std;class Solution{public: int myCount(vector &a,int

2016-09-24 10:54:37 5664 1

原创 pox控制器学习总结

继续努力

2015-11-13 16:30:54 3437 1

原创 pox事件系统

还要继续学习!

2015-11-09 13:24:12 726

原创 学习pox心得

pox学习心得

2015-11-06 12:58:19 1206

空空如也

空空如也

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

TA关注的人

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