自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

码农

我要一步一步往上爬

  • 博客(55)
  • 资源 (1)
  • 收藏
  • 关注

原创 【赛码网】京东2017校园招聘 Java开发工程师

支限界法与回溯法都是在问题的解空间树T上搜索问题的解,关于二者说法中正确的是( )B求解目标不同,搜索方式也不同两者的区别 在一般情况下,分支限界法与回溯法的求解目标不同。回溯法的求解目标是找出T中满足约束条件的所有解,而分支限界法的求解目标则是找出满足约束条件的一个解,或是在满足约束条件的解中找出使某一目标函数值达到极大或极小的解,即在某种意义下的最优解。 一句话,不太...

2018-04-07 19:46:54 320

转载 用于简单CRUD的反射辅助类

import java.lang.reflect.Field;import java.lang.reflect.InvocationTargetException;import java.lang.reflect.Method;import java.lang.reflect.Modifier;import java.lang.reflect.ParameterizedType;imp...

2018-04-06 14:00:19 293

转载 Spring boot Mybatis 整合(完整版)

https://blog.youkuaiyun.com/winter_chen001/article/details/77249029十分给力

2018-03-26 19:59:56 234

转载 CoreException: Could not get the value for parameter compilerId for plugin execution default-compile

原文链接 https://www.sogou.com/link?url=DOb0bgH2eKh1ibpaMGjuyxXW0Zz_myMPm3wyVVcHckdkbaHzbwgePLBn4VA8J3Sxx0FoBN3zHbCH8on5mfRKLQ..在Eclipse中使用 Alt+F5 快捷键,在弹出的Update Maven Project对话框中选择报错的Maven工程,勾选下图中的 Fo...

2018-03-25 14:43:07 591

转载 eclipse alt+/智能提示错误问题the 'org.eclipse.recommenders.completion'

原文地址 https://www.cnblogs.com/zhengyuanyuan/p/8303679.html解决problem during code assist

2018-03-25 11:07:19 2984

原创 【LeetCode】98. Validate Binary Search Tree

Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node’s key. The ...

2018-03-23 09:58:45 148

原创 【LeetCode】169. Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element alwa...

2018-03-22 11:23:31 160

原创 【newCoder】2017春招真题 保留最大的数

题目描述 给定一个十进制的正整数number,选择从里面去掉一部分数字,希望保留下来的数字组成的正整数最大。输入描述: 输入为两行内容,第一行是正整数number,1 ≤ length(number) ≤ 50000。第二行是希望去掉的数字数量cnt 1 ≤ cnt < length(number)。输出描述: 输出保留下来的结果。示例1 输...

2018-03-21 16:19:57 169

原创 【LeetCode】107. Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).For example: Given binary tree [3,9,20,null,null,15,...

2018-03-21 15:53:09 149

原创 【LeetCode】106. Construct Binary Tree from Inorder and Postorder Traversal

Given inorder and postorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree.For example, giveninorder = [9,3,15,20,7] postorder = [...

2018-03-19 15:25:00 178

原创 【LeetCode】111. Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.题目思路:其实该题类似与求树的最大深度,不过不同的是,要考虑 当一个节点只...

2018-03-19 14:17:20 174

原创 【LeetCode】101. Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \3 4 4 3B...

2018-03-18 14:59:08 192

原创 【LeetCode】103. Binary Tree Zigzag Level Order Traversal

Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate between).For example: Given binary tr...

2018-03-18 14:32:27 164

原创 【newCoder】114. Flatten Binary Tree to Linked List

Given a binary tree, flatten it to a linked list in-place.For example, Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like: 1 \ 2 \ ...

2018-03-17 18:39:15 163

原创 【newCoder】2016校招真题在线编程 二分查找

题目描述 对于一个有序数组,我们通常采用二分查找的方式来定位某一元素,请编写二分查找的算法,在数组中查找指定元素。 给定一个整数数组A及它的大小n,同时给定要查找的元素val,请返回它在数组中的位置(从0开始),若不存在该元素,返回-1。若该元素出现多次,请返回第一次出现的位置。 测试样例: [1,3,5,7,9],5,3 返回:1代码如下class BinarySearch...

2018-03-17 17:25:19 194

原创 【LeetCode】104. Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.For example: Given binary tree [3,9,2...

2018-03-17 16:38:04 182

原创 【LeetCode】110. Balanced Binary Tree

题目描述Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as:a binary tree in which the depth of the two subtrees of every node never...

2018-03-17 15:38:56 178

原创 【newCoder】2016校招真题在线编程 懂二进制

题目描述 世界上有10种人,一种懂二进制,一种不懂。那么你知道两个int32整数m和n的二进制表达,有多少个位(bit)不同么?示例1 输入 1999 2299 输出 7具体代码class Solution {public: /** * 获得两个整形二进制表达位数不同的数量 * * @param m 整数m * @par...

2018-03-17 11:27:42 199

原创 【newCoder】2016校招真题在线编程 风口的猪-中国牛市

题目描述 风口之下,猪都能飞。当今中国股市牛市,真可谓“错过等七年”。 给你一个回顾历史的机会,已知一支股票连续n天的价格走势,以长度为n的整数数组表示,数组中第i个元素(prices[i])代表该股票第i天的股价。 假设你一开始没有股票,但有至多两次买入1股而后卖出1股的机会,并且买入前一定要先保证手上没有股票。若两次交易机会都放弃,收益为0。 设计算法,计算你能获得的最大收益。 输入数值范围...

2018-03-16 18:37:35 240

原创 【LeetCode】123. Best Time to Buy and Sell Stock III

题目描述Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note: You ma...

2018-03-16 18:18:51 141

原创 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 ]...

2018-03-16 16:56:05 142

原创 【newCoder】2016校招真题在线编程 小米Git

题目描述git是一种分布式代码管理工具,git通过树的形式记录文件的更改历史,比如: base’<–base<–A<–A’ ^ | — B<–B’ 小米工程师常常需要寻找两个分支最近的分割点,即base.假设git 树是多叉树,请实现一个算法,计算git树上任意两点的最近分割点。 (假设git树节点数为n,用邻接矩阵的形式表示git树:字符串数组matrix包含n个字符...

2018-03-16 14:40:37 197

原创 微软面试题1.把二元查找树转变成排序的双向链表

1.把二元查找树转变成排序的双向链表题目: 输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表。 要求不能创建任何新的结点,只调整指针的指向。 10 / \ 6 14 / \ / \ 4 8 12 16 转换成双向链表 4=6=8=10=12=14=16。 首先我们定义的二元查找树节点的数据结构如下: struct BSTreeNode { int m_nVa...

2018-03-16 14:00:41 196

原创 【LeetCode】55. Jump Game

题目描述Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine...

2018-03-15 17:52:50 110

原创 【LeetCode】59. Spiral Matrix II

题目描述Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example, Given n = 3,You should return the following matrix: [ [ 1, 2, 3 ], [ ...

2018-03-15 11:01:49 114

转载 关于CopyOnWrite的理解与应用

参考链接https://coolshell.cn/articles/11175.html什么是CopyOnWrite容器 CopyOnWrite容器即写时复制的容器。通俗的理解是当我们往一个容器添加元素的时候,不直接往当前容器添加,而是先将当前容器进行Copy,复制出一个新的容器,然后新的容器里添加元素,添加完元素之后,再将原容器的引用指向新的容器。这样做的好处是我们可以对CopyOnW...

2018-03-15 10:23:31 758

原创 【newCoder】2017春招真题 不要二

题目描述二货小易有一个W*H的网格盒子,网格的行编号为0~H-1,网格的列编号为0~W-1。每个格子至多可以放一块蛋糕,任意两块蛋糕的欧几里得距离不能等于2。 对于两个格子坐标(x1,y1),(x2,y2)的欧几里得距离为: ( (x1-x2) * (x1-x2) + (y1-y2) * (y1-y2) ) 的算术平方根 小易想知道最多可以放多少块蛋糕在网格盒子里。输入描述:每组...

2018-03-13 20:27:30 192

原创 【newCoder】2017春招真题 [编程题]水仙花数

题目描述 春天是鲜花的季节,水仙花就是其中最迷人的代表,数学上有个水仙花数,他是这样定义的: “水仙花数”是指一个三位数,它的各位数字的立方和等于其本身,比如:153=1^3+5^3+3^3。 现在要求输出所有在m和n范围内的水仙花数。输入描述: 输入数据有多组,每组占一行,包括两个整数m和n(100 ≤ m ≤ n ≤ 999)。输出描述: 对于每个测试实...

2018-03-13 18:29:55 190

原创 【newCoder】2017春招真题 [编程题]句子反转

题目描述 给定一个句子(只包含字母和空格), 将句子中的单词位置反转,单词用空格分割, 单词之间只有一个空格,前后没有空格。 比如: (1) “hello xiao mi”-> “mi xiao hello”输入描述: 输入数据有多组,每组占一行,包含一个句子(句子长度小于1000个字符)输出描述: 对于每个测试示例,要求输出句子中单词反转后形成的句子 ...

2018-03-13 18:08:49 203

原创 【newCoder】2017春招真题 [编程题] 统计字符

题目描述 给定一个英文字符串,请写一段代码找出这个字符串中首先出现三次的那个英文字符。输入描述 输入数据一个字符串,包括字母,数字等。输出描述 输出首先出现三次的那个英文字符示例1 输入 Have you ever gone shopping and 输出 e题目思路 不管是统计数字还是字母,都是采用桶统...

2018-03-13 16:58:22 258

原创 #1049 : 后序遍历

题目链接https://hihocoder.com/problemset/problem/1049?sid=1283579题目思路 前序遍历=根+左儿子+右儿子 中序遍历=左儿子+根+右儿子 后序遍历=左儿子+右儿子+根代码如下#include<iostream>#include<string>using namespace...

2018-03-12 20:18:16 147

原创 【LeetCode】66. Plus One

题目描述 Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leading zero, except the number 0 itself....

2018-03-12 18:18:52 218

原创 【newCoder】2017春招真题 [编程题] 分苹果

题目描述 n 只奶牛坐在一排,每个奶牛拥有 ai 个苹果,现在你要在它们之间转移苹果,使得最后所有奶牛拥有的苹果数都相同,每一次,你只能从一只奶牛身上拿走恰好两个苹果到另一个奶牛上,问最少需要移动多少次可以平分苹果,如果方案不存在输出 -1。示例1 输入 4 7 15 9 5 输出 3代码如下#include <iostream>...

2018-03-12 16:58:42 257

原创 【newCoder】2017春招真题 [编程题]下厨房

题目描述 牛牛想尝试一些新的料理,每个料理需要一些不同的材料,问完成所有的料理需要准备多少种不同的材料。输入描述: 每个输入包含 1 个测试用例。每个测试用例的第 i 行,表示完成第 i 件料理需要哪些材料,各个材料用空格隔开,输入只包含大写英文字母和空格,输入文件不超过 50 行,每一行不超过 50 个字符。输出描述: 输出一行一个数字表示完成所有料理...

2018-03-11 19:41:32 259

原创 【newCoder】查找入职员工时间排名倒数第三的员工所有信息

题目描述 查找入职员工时间排名倒数第三的员工所有信息 CREATE TABLE employees ( emp_no int(11) NOT NULL, birth_date date NOT NULL, first_name varchar(14) NOT NULL, last_name varchar(16) NOT NULL, gender cha...

2018-03-11 15:46:23 362

原创 【newCoder】查找最晚入职员工的所有信息

题目描述 查找最晚入职员工的所有信息 CREATE TABLE employees ( emp_no int(11) NOT NULL, birth_date date NOT NULL, first_name varchar(14) NOT NULL, last_name varchar(16) NOT NULL, gender char(1) NOT...

2018-03-11 15:37:33 288

原创 #1043 : 完全背包

题目链接 https://hihocoder.com/problemset/problem/1043题目思路 其实多重背包就是0-1背包的变种,状态转移方程如下#include <iostream>#include<string.h>using namespace std;int solve(int *need,int*value,i...

2018-03-10 17:14:10 183

原创 【LeetCode】82. Remove Duplicates from Sorted List II

题目描述 Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.输入样例和输出样例 For example, Given 1->2->3->3->4...

2018-03-09 20:46:30 112

原创 【newCoder】剑指Offer_编程题 合并两个排序的链表

题目描述 输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则。题目思路 该题通过新建一个首节点,通过比较两个队列的首节点的大小,决定把首节点的值小的队列加入到新队种中,并将该节点删除,直到两个队列有个为空为止,此时再将不为空的队列加入到新队列中。代码如下/*struct ListNode { int val;...

2018-03-09 17:34:12 158

原创 【hihocoder】#1037 : 数字三角形

题目链接 https://hihocoder.com/problemset/problem/1037题目思路该题是典型的DP问题,状态转移方程为dp(i,j)=triangle(i,j)+max(dp(i+1,j),dp(i+1,j+1))代码如下#include <iostream>using namespace std;int solve(in...

2018-03-09 15:56:35 167

慕课 MYSQL性能管理及架构设计

MYSQL性能管理及架构设计,值得一看, MYSQL性能管理及架构设计,

2018-05-04

空空如也

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

TA关注的人

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