自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 leetcode刷题之 数组与矩阵(7):找出数组中重复的数,数组值在 [1, n] 之间

[LeetCode] Find the Duplicate Number 寻找重复数Given an arraynumscontainingn+ 1 integers where each integer is between 1 andn(inclusive), prove that at least one duplicate number must exist. Ass...

2019-06-30 11:12:37 165

转载 leetcode刷题之 数组与矩阵(6):一个数组元素在 [1, n] 之间,其中一个数被替换为另一个数,找出重复的数和丢失的数

[LeetCode] Set Mismatch 设置不匹配The setSoriginally contains numbers from 1 ton. But unfortunately, due to the data error, one of the numbers in the set got duplicated toanothernumber in the set...

2019-06-30 10:40:00 190

转载 leetcode刷题之 数组与矩阵(5):有序矩阵的 Kth Element

[LeetCode] Kth Smallest Element in a Sorted Matrix 有序矩阵中第K小的元素Given anxnmatrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix....

2019-06-30 10:18:49 139

转载 leetcode刷题之 数组与矩阵(3):找出数组中最长的连续 1

[LeetCode] Max Consecutive Ones 最大连续1的个数Given a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two d...

2019-06-29 11:28:38 226

转载 leetcode刷题之 数组与矩阵(4):有序矩阵查找

[LeetCode] Search a 2D Matrix II 搜索一个二维矩阵之二Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted...

2019-06-29 11:26:00 123

转载 leetcode刷题之 数组与矩阵(2):改变矩阵维度

[LeetCode] Reshape the Matrix 重塑矩阵In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data.You're gi...

2019-06-29 11:00:25 118

转载 leetcode刷题之 数组与矩阵(1):把数组中的 0 移到末尾

[LeetCode] Move Zeroes 移动零Given an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.For example, givennums = [0, 1, 0...

2019-06-29 11:00:01 210

转载 leetcode刷题之 字符串(9):统计二进制字符串中连续 1 和连续 0 数量相同的子字符串个数

[LeetCode] Count Binary Substrings 统计二进制子字符串Give a strings, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in the...

2019-06-29 10:01:01 1678

转载 leetcode刷题之 字符串(8):判断一个整数是否是回文数

[LeetCode] Palindrome Number 验证回文数字Determine whether an integer is a palindrome. An integerisapalindrome when itreads the same backward as forward.Example 1:Input: 121Output: trueExa...

2019-06-29 09:09:48 115

转载 leetcode刷题之 字符串(6):字符串同构

[LeetCode] Isomorphic Strings 同构字符串Given two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All occurrences of a ...

2019-06-28 10:13:14 92

转载 leetcode刷题之 字符串(5): 计算一组字符集合可以组成的回文字符串的最大长度

[LeetCode] Longest Palindrome 最长回文串Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.This is case ...

2019-06-28 10:13:08 166

转载 leetcode刷题之 字符串(4):两个字符串包含的字符是否完全相同

242. Valid Anagram (Easy)s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.由于本题的字符串只包含 26 个小写字符,因此可以使用长度为 26 的整型数组对字符串出现的字符进行统计,不再使用 HashMap。class Solution { ...

2019-06-28 10:13:03 245

转载 leetcode刷题之 字符串(3): 字符串中单词的翻转

s = "I am a student"Return "student a am I"将每个单词翻转,然后将整个字符串翻转。public static void Reverse(char[] array, int start, int end) { if (array == null || start < 0 || end > array.Leng...

2019-06-28 10:12:56 127

转载 leetcode刷题之 字符串(2):字符串循环移位

字符串循环移位把字符串移动n位。可以一个一个移动,这样的话,要移动n次,每次移动len个。算法时间复杂度为O(n*len)。也可以开辟一个新的内存,把移动的最终位置计算出来,直接放到那里即可,这样时间负责度为O(1),空间复杂度为O(len)。除此之外,还有时间负责度为O(1),空间负责度也为O(1)的算法。第一种方法为把右边的向左移,每次移动n位。一直到末尾,再把末尾的反转好...

2019-06-28 10:12:50 688

转载 leetcode刷题之 字符串(1):字符串循环移位包含

字符串——循环移位包含问题s1 = AABCD, s2 = CDAAReturn : true给定两个字符串 s1 和 s2,要求判定 s2 是否能够被 s1 做循环移位得到的字符串包含。s1 进行循环移位的结果是 s1s1 的子字符串,因此只要判断 s2 是否是 s1s1 的子字符串即可。方法一:构建辅助字符串,利用了额外的空间解析:构建一个辅助字符串s = s...

2019-06-28 10:12:42 725

转载 leetcode刷题之 哈希表(4): 最长连续序列

[LeetCode] Longest Consecutive Sequence 求最长连续序列Given an unsorted array of integers, find the length of the longest consecutive elements sequence.Your algorithm should run in O(n) complexity.E...

2019-06-27 14:27:29 151

转载 leetcode刷题之 哈希表(3): 最长和谐序列

[LeetCode] Longest Harmonious Subsequence 最长和谐子序列We define a harmonious array is an array where the difference between its maximum value and its minimum value isexactly1.Now, given an integer...

2019-06-27 10:48:50 177

转载 leetcode刷题之 哈希表(2): 判断数组是否含有重复元素

Contains DuplicateGiven an array of integers, find if the array contains any duplicates.Your function should return true if any value appears at least twice in the array, and it should return fals...

2019-06-27 09:46:03 420

转载 leetcode刷题之 哈希表(1):数组中两个数的和为给定值

哈希表使用 O(N) 空间复杂度存储数据,并且以 O(1) 时间复杂度求解问题。 Java 中的HashSet用于存储一个集合,可以查找元素是否在集合中。如果元素有穷,并且范围不大,那么可以用一个布尔数组来存储一个元素是否存在。例如对于只有小写字符的元素,就可以用一个长度为 26 的布尔数组来存储一个字符集合,使得空间复杂度降低为 O(1)。 Java 中的HashMap主...

2019-06-27 09:35:46 801

原创 配置过程

固态坏了所有的东西的都没了,得从头配置一遍,记录一哈:1. 配置ideal的激活2.配置jdk: javahome,3.配置maven及其本地仓库:mavenhome, 阿里云仓库4.配置mysql : 记得更改数据存储地址和导入数据,mysqlHome...

2019-06-26 16:13:27 80

转载 leetcode刷题之 栈和队列(6):循环数组中比当前元素大的下一个元素

503.Next Greater Element IIMedium61038FavoriteShareGiven a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every eleme...

2019-06-26 11:12:20 147

转载 leetcode刷题之 栈和队列(5):数组中元素与下一个比它大的元素之间的距离

[LeetCode] Daily Temperatures 日常温度Given a list of daily temperaturesT, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer temperature....

2019-06-26 10:47:49 199

转载 leetcode刷题之 栈和队列(4):验证括号

[LeetCode] Valid Parentheses 验证括号Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.An input string is valid if:Open brackets m...

2019-06-26 10:14:17 144

转载 leetcode刷题之 栈和队列(3):最小值栈

[LeetCode] Min Stack 最小栈Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack. pop() -- Removes the element on t...

2019-06-26 10:00:10 142

转载 leetcode刷题之 栈和队列(2):用队列实现栈

[LeetCode] Implement Stack using Queues 用队列来实现栈Implement the following operations of a stack using queues.push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack...

2019-06-26 09:39:30 99

转载 leetcode刷题之 栈和队列(1):用栈实现队列

[LeetCode] Implement Queue using Stacks 用栈来实现队列Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue. pop() -- Removes the element from in f...

2019-06-26 09:22:02 140

转载 搞懂分布式技术开篇:浅析分布式系统的架构及常用方案

WeTest导读我们常常会听说,某个互联网应用的服务器端系统多么牛逼,比如QQ、微信、淘宝。那么,一个互联网应用的服务器端系统,到底牛逼在什么地方?为什么海量的用户访问,会让一个服务器端系统变得更复杂?本文就是想从最基本的地方开始,探寻服务器端系统技术的基础概念。承载量是分布式系统存在的原因当一个互联网业务获得大众欢迎的时候,最显著碰到的技术问题,就是服务器非常繁忙。当每天有1000...

2019-06-24 17:26:35 324

转载 搞懂分布式技术1:分布式系统的一些基本概念

本文较为粗略地讲述了CAP与BASE理论,以及分布式系统需要解决的一些问题,更加系统的理论可以参考后面的分布式系统理论专题文章。更加详细的实践内容也可以参考本专题的剩余文章1、分布式小明的公司又3个系统:系统A,系统B和系统C,这三个系统所做的业务不同,被部署在3个独立的机器上运行,他们之间互相调用(当然是跨域网络的),通力合作完成公司的业务流程。将不同的业务分部在不同的地方,...

2019-06-24 16:39:43 341

原创 数据结构(四) 二分搜索树2

2 删二分搜索树中的最大最小元素重点是考虑要删除节点的左孩子或者有孩子怎么连接到父节点//删除最小值所在的节点 public E removeMin(){ E ret = minimum(); root = removeMin(root); return ret; ...

2019-06-24 16:08:41 80

原创 数据结构(四) 二分搜索树1

一 为什么要研究树结构二 二叉树三 二分搜索树public class BST<E extends Comparable<E>> { private class Node{ public E e; public Node left, right; public Node(E ...

2019-06-24 15:52:26 73

原创 数据结构(三) 链表

package com.company;public class LinkedList<E> { private class Node{ public E e; public Node next; public Node(E e, Node next){ this.e...

2019-06-24 15:39:53 135

原创 数据结构(二) 栈和队列

1 栈应用1 :用栈实现撤销操作应用2 系统栈2 栈的实现栈的基本实现(依据动态数组完成)package com.company;public interface Stack<E> { int getSize(); boolean isEmpty(); void push(E e);...

2019-06-24 15:25:22 83

原创 数据结构(一)数组

数组的定义:把数据码成一排进行存放,数组中元素的类型要一样; 索引(序号有关)数组最大的优点:快速查询 arr[4]数组最好应用于“索引有语意的情况”,但并非所有有语意的所有都适用于数组 身份证号:370115866418965233package com.company;//实现数组的常用方法public class Array { private in...

2019-06-24 15:02:56 120

转载 leetcode刷题之 树(30):Trie

实现一个 Trie实现一个 Trie,用来求前缀和参考数据结构线段树

2019-06-24 14:49:03 94

转载 leetcode刷题之 树(29):寻找二叉查找树中出现次数最多的值

[LeetCode] Find Mode in Binary Search Tree 找二分搜索数的众数Given a binary search tree (BST) with duplicates, find all themode(s)(the most frequently occurred element) in the given BST.Assume a BST i...

2019-06-24 14:48:38 203

转载 leetcode刷题之 树(28):在二叉查找树中查找两个节点之差的最小绝对值

[LeetCode] Minimum Absolute Difference in BST 二叉搜索树的最小绝对差Given a binary search tree with non-negative values, find the minimumabsolute differencebetween values of any two nodes.Example:Inp...

2019-06-23 11:53:26 165

转载 leetcode刷题之 树(27):在二叉查找树中寻找两个节点,使它们的和为一个给定值

[LeetCode] Two Sum IV - Input is a BST 两数之和之四 - 输入是二叉搜索树Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the give...

2019-06-23 11:53:19 161

转载 leetcode刷题之 树(26):根据有序链表构造平衡的二叉查找树

[LeetCode] 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.For this problem, a...

2019-06-23 11:05:10 128

转载 leetcode刷题之 树(25):从有序数组中构造二叉查找树

[LeetCode] Convert Sorted Array to Binary Search Tree 将有序数组转为二叉搜索树Given an array where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-bal...

2019-06-23 10:32:09 244

转载 leetcode刷题之 树(23):把二叉查找树每个节点的值都加上比它大的节点的值

[LeetCode] Convert BST to Greater Tree 将二叉搜索树BST转为较大树Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum...

2019-06-23 09:42:13 352

空空如也

空空如也

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

TA关注的人

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