自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

老汉技术专栏

Java开发程序猿一枚~欢迎各位批评指正

  • 博客(67)
  • 收藏
  • 关注

原创 浅谈Telegraf+InfluxDB+Grafana快速搭建简易实时监控系统

监控从来都是一个很宽泛的问题,任何可能出问题的地方都需要加入监控。全量监控的确是监控的终极目标。在搭建一套监控系统前,需要结合实际的系统情况和发展趋势进行考量。在作者看来,一套监控系统应主要由数据采集、数据存储、数据展示三部分构成。作者经过大量阅读相关资料后,最终选择了Telegraf+InfluxDB+Grafana这套方案。接下来,作者就对这套监控系统方案进行简要的介绍。 Telegraf+I...

2018-04-19 17:10:41 18980 3

原创 LintCode 90. k数和 II

Your title here...Given n unique integers, number k (1<=k<=n) and target.Find all possible k integers where their sum is target.public class Solution { /* * @param A: an integer array ...

2018-04-23 20:35:32 333

原创 LintCode 89. k数和

给定n个不同的正整数,整数k(k < = n)以及一个目标数字。 在这n个数里面找出K个数,使得这K个数的和等于目标数字,求问有多少种方案?public class Solution { /** * @param A: An integer array * @param k: A positive integer (k <= length(A)) ...

2018-04-23 20:34:15 456

原创 LintCode 88. 最近公共祖先

给定一棵二叉树,找到两个节点的最近公共父节点(LCA)。最近公共祖先是两个节点的公共的祖先节点且具有最大深度。public class Solution { /* * @param root: The root of the binary search tree. * @param A: A TreeNode in a Binary. * @param B: ...

2018-04-22 17:43:33 285

原创 LintCode 87. 删除二叉查找树的节点

给定一棵具有不同节点值的二叉查找树,删除树中与给定值相同的节点。如果树中没有相同值的节点,就不做任何处理。你应该保证处理之后的树仍是二叉查找树。public class Solution { /* * @param root: The root of the binary search tree. * @param value: Remove the node with...

2018-04-22 17:42:07 218

原创 LintCode 84. 落单的数 III

给出2*n + 2个的数字,除其中两个数字之外其他每个数字均出现两次,找到这两个数字。public class Solution { /* * @param A: An integer array * @return: An integer array */ public List<Integer> singleNumberIII(int[...

2018-04-22 17:41:00 186

原创 LintCode 83. 落单的数 II

给出3*n + 1 个的数字,除其中一个数字之外其他每个数字均出现三次,找到这个数字。public class Solution { /** * @param A: An integer array * @return: An integer */ public int singleNumberII(int[] A) { // write your ...

2018-04-18 09:09:00 173

原创 LintCode 82. 落单的数

给出2*n + 1 个的数字,除其中一个数字之外其他每个数字均出现两次,找到这个数字。public class Solution { /** * @param A: An integer array * @return: An integer */ public int singleNumber(int[] A) { // write your co...

2018-04-18 09:07:20 213

原创 LintCode 75. 寻找峰值

你给出一个整数数组(size为n),其具有以下特点:相邻位置的数字是不同的A[0] < A[1] 并且 A[n - 2] > A[n - 1]假定P是峰值的位置则满足A[P] > A[P-1]且A[P] > A[P+1],返回数组中任意一个峰值的位置。public class Solution { /* * @param A: An integers arra...

2018-04-18 09:03:54 192

原创 LintCode 72. 中序遍历和后序遍历树构造二叉树

根据中序遍历和后序遍历树构造二叉树/** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int val) { * this.val = val; * ...

2018-04-17 09:04:03 188

原创 LintCode 71. 二叉树的锯齿形层次遍历

给出一棵二叉树,返回其节点值的锯齿形层次遍历(先从左往右,下一层再从右往左,层与层之间交替进行) /** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int val) {...

2018-04-17 09:02:43 166

原创 LintCode 70. 二叉树的层次遍历 II

给出一棵二叉树,返回其节点值从底向上的层次序遍历(按从叶节点所在层到根节点所在的层遍历,然后逐层从左往右遍历)/** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int v...

2018-04-17 09:01:14 163

原创 LintCode 69. 二叉树的层次遍历

给出一棵二叉树,返回其节点值的层次遍历(逐层从左往右访问)/** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int val) { * this.val ...

2018-04-17 08:59:41 165

原创 LintCode 66. 二叉树的前序遍历

给出一棵二叉树,返回其节点值的前序遍历。/** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int val) { * this.val = val; *...

2018-04-17 08:57:07 263

原创 LintCode 63. 搜索旋转排序数组 II

跟进“搜索旋转排序数组”,假如有重复元素又将如何?是否会影响运行时间复杂度?如何影响?为何会影响?写出一个函数判断给定的目标值是否出现在数组中。public class Solution { /** * @param A: an integer ratated sorted array and duplicates are allowed * @param target: A...

2018-04-17 08:55:29 117

原创 LintCode 62. 搜索旋转排序数组

假设有一个排序的按未知的旋转轴旋转的数组(比如,0 1 2 4 5 6 7 可能成为4 5 6 7 0 1 2)。给定一个目标值进行搜索,如果在数组中找到目标值返回数组中的索引位置,否则返回-1。你可以假设数组中不存在重复的元素。public class Solution { /** * @param A: an integer rotated sorted array * ...

2018-04-17 08:54:03 177

原创 LintCode 61. 搜索区间

给定一个包含 n 个整数的排序数组,找出给定目标值 target 的起始和结束位置。如果目标值不在数组中,则返回[-1, -1]public class Solution { /** * @param A: an integer sorted array * @param target: an integer to be inserted * @return: a l...

2018-04-17 08:52:07 179

原创 LintCode 59. 最接近的三数之和

给一个包含 n 个整数的数组 S, 找到和与给定整数 target 最接近的三元组,返回这三个数的和。public class Solution { /** * @param numbers: Give an array numbers of n integer * @param target: An integer * @return: return the sum...

2018-04-17 08:50:12 272

原创 LintCode 57. 三数之和

给出一个有n个整数的数组S,在S中找到三个整数a, b, c,找到所有使得a + b + c = 0的三元组。public class Solution { /** * @param numbers: Give an array numbers of n integer * @return: Find all unique triplets in the array whic...

2018-04-17 08:48:35 182

原创 LintCode 56. 两数之和

给一个整数数组,找到两个数使得他们的和等于一个给定的数 target。你需要实现的函数twoSum需要返回这两个数的下标, 并且第一个下标小于第二个下标。注意这里下标的范围是 0 到 n-1。public class Solution { /** * @param numbers: An array of Integer * @param target: target = n...

2018-04-17 08:46:13 140

原创 LintCode 55. 比较字符串

比较两个字符串A和B,确定A中是否包含B中所有的字符。字符串A和B中的字符都是 大写字母public class Solution { /** * @param A: A string * @param B: A string * @return: if string A contains all of the characters in B return true ...

2018-04-16 09:55:01 111

原创 LintCode 49. 字符大小写排序

给定一个只包含字母的字符串,按照先小写字母后大写字母的顺序进行排序。public class Solution { /* * @param chars: The letter array you should sort by Case * @return: nothing */ public void sortLetters(char[] chars) { ...

2018-04-16 09:29:31 242

原创 LintCode 46. 主元素

给定一个整型数组,找出主元素,它在数组中的出现次数严格大于数组元素个数的二分之一。public class Solution { /* * @param nums: a list of integers * @return: find a majority number */ public int majorityNumber(List<Integer&...

2018-04-16 09:25:51 113

原创 LintCode 45. 最大子数组差

给定一个整数数组,找出两个不重叠的子数组A和B,使两个子数组和的差的绝对值|SUM(A) - SUM(B)|最大。返回这个最大的差值。public class Solution { /** * @param nums: A list of integers * @return: An integer indicate the value of maximum differen...

2018-04-16 09:23:46 239

原创 LintCode 44. 最小子数组

给定一个整数数组,找到一个具有最小和的子数组。返回其最小和。public class Solution { /* * @param nums: a list of integers * @return: A integer indicate the sum of minimum subarray */ public int minSubArray(Li...

2018-04-16 09:18:25 126

原创 LintCode 42. 最大子数组 II

给定一个整数数组,找出两个 不重叠 子数组使得它们的和最大。每个子数组的数字在数组中的位置应该是连续的。返回最大的和。public class Solution { /* * @param nums: A list of integers * @return: An integer denotes the sum of max two non-overlapping suba...

2018-04-16 08:55:16 206

原创 LintCode 41. 最大子数组

给定一个整数数组,找到一个具有最大和的子数组,返回其最大和。public class Solution { /** * @param nums: A list of integers * @return: A integer indicate the sum of max subarray */ public int maxSubArray(int[] nums...

2018-04-16 08:53:33 173

原创 LintCode 40. 用栈实现队列

正如标题所述,你需要使用两个栈来实现队列的一些操作。队列应支持push(element),pop() 和 top(),其中pop是弹出队列中的第一个(最前面的)元素。pop和top方法都应该返回第一个元素的值。public class MyQueue { Stack<Integer> stack1 = new Stack<>(); Stack<Intege...

2018-04-16 08:51:33 163

原创 LintCode 39. 恢复旋转排序数组

给定一个旋转排序数组,在原地恢复其排序。public class Solution { /** * @param nums: An integer array * @return: nothing */ public void recoverRotatedSortedArray(List<Integer> nums) { // write...

2018-04-16 08:49:56 175

原创 LintCode 38. 搜索二维矩阵 II

写出一个高效的算法来搜索m×n矩阵中的值,返回这个值出现的次数。这个矩阵具有以下特性:每行中的整数从左到右是排序的。每一列的整数从上到下是排序的。在每一行或每一列中没有重复的整数。public class Solution { /** * @param matrix: A list of lists of integers * @param target: An intege...

2018-04-16 08:47:39 121

原创 LintCode 37. 反转一个3位整数

反转一个只有3位数的整数。public class Solution { /** * @param number: A 3-digit number. * @return: Reversed number. */ public int reverseInteger(int number) { // write your code her...

2018-04-16 08:44:11 1575

原创 LintCode 36. 翻转链表 II

翻转链表中第m个节点到第n个节点的部分/** * Definition for ListNode * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } *...

2018-04-15 13:44:26 197

原创 LintCode 35. 翻转链表

翻转一个链表/** * Definition for ListNode * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } */public cla...

2018-04-15 13:43:00 101

原创 LintCode 32. 最小子串覆盖

给定一个字符串source和一个目标字符串target,在字符串source中找到包括所有目标字符串字母的子串。public class Solution { /** * @param source : A string * @param target: A string * @return: A string denote the minimum windo...

2018-04-15 13:15:49 741

原创 LintCode 31. 数组划分

给出一个整数数组 nums 和一个整数 k。划分数组(即移动数组 nums 中的元素),使得:所有小于k的元素移到左边所有大于等于k的元素移到右边返回数组划分的位置,即数组中第一个位置 i,满足 nums[i] 大于等于 k。public class Solution { /** * @param nums: The integer array you should partit...

2018-04-15 13:14:30 140

原创 LintCode 30. 插入区间

给出一个无重叠的按照区间起始端点排序的区间列表。在列表中插入一个新的区间,你要确保列表中的区间仍然有序且不重叠(如果有必要的话,可以合并区间)。/** * Definition of Interval: * public classs Interval { * int start, end; * Interval(int start, int end) { * ...

2018-04-15 13:12:34 130

原创 LintCode 29. 交叉字符串

给出三个字符串:s1、s2、s3,判断s3是否由s1和s2交叉构成。public class Solution { /** * @param s1: A string * @param s2: A string * @param s3: A string * @return: Determine whether s3 is formed by int...

2018-04-15 13:11:06 214

原创 LintCode 28. 搜索二维矩阵

写出一个高效的算法来搜索 m × n矩阵中的值。这个矩阵具有以下特性:每行中的整数从左到右是排序的。每行的第一个数大于上一行的最后一个整数public class Solution { /** * @param matrix: matrix, a list of lists of integers * @param target: An integer * @...

2018-04-15 13:09:17 113

原创 LintCode 24. LFU缓存

LFU是一个著名的缓存算法实现LFU中的set 和 getpublic class LFUCache { private Map<Integer, Node> cache; private int capacity = 0; private int used = 0; /* * @param capacity: An integer ...

2018-04-15 13:07:45 521

原创 LintCode 20. 骰子求和

扔 n 个骰子,向上面的数字之和为 S。给定 Given n,请列出所有可能的 S 值及其相应的概率。public class Solution { /** * @param n an integer * @return a list of Map.Entry<sum, probability> */ public List<Map....

2018-04-15 13:06:05 194

空空如也

空空如也

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

TA关注的人

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