- 博客(85)
- 收藏
- 关注
原创 mysql主从库
搭建mysql主从库系统环境 cenOS 7准备10.232.10.32 主库 10.232.10.33 从库主库配置修改主库配置vim /etc/my.id[mysqld]log-bin=mysql-bin #开启二进制日志server-id=1 #设置server-id重启mysql并创建从服务器访问的账号service mysql...
2018-03-21 15:44:30
349
原创 mysql中char和varchar的区别
mysql中char和varchar的区别字符串是mysql中最长用的数据类型了。 varchar数据的特点: 长度可变,性能差一点。长度是64k。varchar需要额外的一到两个字节来存放varchar中数据的长度。如果长度大于255的话就需要使用两位。在utf-8下一个中文字符占用3个字节,在gbk下面占用的长度是2个字节。在4.01之前版本中 varchar(12)表示12个字节
2018-01-25 17:05:06
932
原创 在创建索引的时候指定索引字段的长度
mysql创建索引的时候指定索引长度大部分的索引前面一部分的长度就能够有很好的区分度了。 通过减小索引长度,这样能够减小索引文件的大小,能够加快数据的insert。语法CREATE INDEX index_name ON table_name (column_name(length), clolumn_name(length)…);如何确认当前字段设置一个合适的长度呢? sel
2018-01-25 16:24:45
13914
原创 跨行交易的一些常见的知识
跨行交易的一些常见的知识实例 用户在a银行取b银行账户中的钱,这个时候就属于跨行取钱。 关键有两个问题: 首先是 信息流 银行之前是如何传递金钱的消息的。 第二是资金流: 银行之间是如何传递金钱的。这个过程是一个发展的过程: 古代 汇票+ 账本 = 信息流 镖局 = 资金流首先是用户拿着a银行的汇票在取b银行取钱,b银行会收下汇票把钱给用户,同时将账记录下来。
2018-01-24 11:32:51
4313
1
原创 LeetCode 148. Sort List
问题描述https://leetcode.com/problems/sort-list/description/ Sort a linked list in O(n log n) time using constant space complexity. 使用空间复杂度为常量,时间复杂度为 O(nlgn)对链表进行排序。问题分析排序的算法复杂度为O(nlgn)的有三种,快速排序,堆
2018-01-21 18:21:59
234
原创 LeetCode 179. Largest Number
问题描述https://leetcode.com/problems/largest-number/description/ Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the
2018-01-21 15:00:46
250
原创 LeetCode 147. Insertion Sort List
问题描述https://leetcode.com/problems/insertion-sort-list/description/ Sort a linked list using insertion sort.问题分析给定一个链表,对这个链表进行插入排序。 步骤: 第一个:是从原有的链表中取出一个节点。 第二步:在排序后的链表中找出对应节点的位置 第三步:将取出的节点
2018-01-20 22:34:00
191
原创 LeetCode 524. Longest Word in Dictionary through Deleting
问题描述https://leetcode.com/problems/longest-word-in-dictionary-through-deleting/description/Given a string and a string dictionary, find the longest string in the dictionary that can be formed by de
2018-01-20 20:51:46
216
原创 LeetCode 274. H-Index
问题描述https://leetcode.com/problems/h-index/description/ Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher’s h-index.
2018-01-19 14:40:07
270
原创 maven 生成一个骨架
场景可能需要创建很多的工程,这些工程都有一些相同的部分,不用每次都重头开始创建。可以使用mavne中的archetype。先将这些工程公共部分创建好,生成一个archetypetype。发布到仓库,后期都根据当前的骨架来创建,创建出来的工程中包含了之前骨架中包含的内容。这样能够复用。实现步骤创建工程将所有公用代码都写入到工程中。编译,测试,打包,通过。执行archetype:cr
2018-01-18 16:57:23
2597
转载 mac安装mysql
http://blog.csdn.net/lkxlaz/article/details/54580735步骤安装Homebrew,详细步骤参见Homebrew官网。brew doctor确认brew在正常工作。brew update更新包。brew install mysql 安装mysql。==> Downloading https://homebrew.bintray.c
2018-01-07 20:52:14
446
原创 SQ3R学习法
SQ3R表示 浏览,问题,阅读,复述,回顾五个步骤的缩写。是一种常见的学习法。浏览:在拿到材料的时候,首先阅读材料的目录,各个小节的标题,书的序言,推荐序等。在这个过程中确定阅读的主题,目的以及注意重点。 问题:在浏览的过程中提出一些问题。主要是使用6何法,去提出一些问题。 阅读:阅读的过程中需要做到眼到,手到,心到。在阅读的过程中不断带着第二阶段的问题却阅读,同时在阅读过程中不断的找出新的问题
2018-01-04 11:34:27
1670
原创 linux常用命令
linux常用命令压缩/解压命令解压:tar zxvf fileName.tar 压缩:tar czvf fileName.tar dirName范例: tar zxvf fileName.tar 表示将fileName的tar文件进行解压 tar czvf fileName.tar firName 表示将dirName目录压缩到fileName.tar文件中去。复制命令cp [opeti
2018-01-03 15:23:48
219
原创 热点数据的实现
在系统中有一些数据是大多数线程都会访问的,这个时候就会产生竞争。例如库存。商品库存主要的库存的要求:首先是无论怎么减都不能小于0,第二点是尽可能的高效。实现方式一:对于不能小于0,可以通过sql命令来实现。 update account set count = count -1 where name = "cloth" AND count>0这样
2017-10-14 18:12:28
3383
原创 LeetCode 283. Move Zeroes
问题描述Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling your f
2017-10-14 15:29:34
273
原创 LeetCode 53. Maximum Subarray
问题描述Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has
2017-10-14 15:05:58
249
原创 LeetCode 561. Array Partition I
问题描述Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as pos
2017-10-14 14:15:51
231
原创 LeetCode 566. 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 given a matrix represented by a two-dime
2017-10-14 13:40:24
222
原创 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.The digits ar
2017-10-11 19:32:36
249
原创 LeetCode 674. Longest Continuous Increasing Subsequence
问题描述Given an unsorted array of integers, find the length of longest continuous increasing subsequence. Example 1: Input: [1,3,5,4,7] Output: 3 Explanation: The longest continuous increasing subsequ
2017-10-11 19:23:16
261
原创 LeetCode 119. Pascal's Triangle II
问题描述Given an index k, return the kth row of the Pascal’s triangle.For example, given k = 3, Return [1,3,3,1].Note: Could you optimize your algorithm to use only O(k) extra space?题目描述给定一个数,返回杨辉三角中对应的行
2017-10-11 19:18:54
200
原创 LeetCode 118. Pascal's Triangle
问题描述Given numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5, Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ]题目描述杨辉三角,一个数等于他肩上的两个数的和。两
2017-10-10 19:38:31
232
原创 LeetCode 268. Missing Number
问题描述Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.For example, Given nums = [0, 1, 3] return 2.Note: Your algorithm should run in
2017-10-10 19:34:27
183
原创 Spring中循环依赖
Spring中bean的实例化方法主要是 prototype和singleton两种。其中singleton的循环依赖包括两种:构造器循环依赖,和setter的循环依赖。prototype中的循环依赖。1.singleton 构造器循环依赖代码示例:public class CycleA { private CycleB cycleB; public CycleA(CycleB cyc
2017-10-08 12:05:10
951
原创 LeetCode 532. K-diff Pairs in an Array
问题描述Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are both numbers
2017-10-08 10:30:47
345
原创 LeetCode 215. Kth Largest Element in an Array
问题描述Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example, Given [3,2,1,5,6,4] and k = 2, return 5.No
2017-10-08 09:50:26
251
原创 Spring读取Bean的过程
Spring中Bean加载的过程是一个关键的步骤。这个过程主要是通过BeanFactoyr中的getBean方法来实现的。具体的方法是在AbstractBeanFactory方法中实现的。getBean方法主要有两个功能,首先是去缓存中读取bean,如果没有就实例化这个bean,实例化bean的过程是一个将GenericBeanDefinition转变为一个正式的bean的过程。 具体实现的方法是
2017-09-30 12:23:08
733
原创 LeetCode 414. Third Maximum Number
问题描述Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n). Example 1: Input: [3, 2,
2017-09-28 16:43:29
209
原创 Spring FactoryBean
Spring中提供了一种方便扩展/构造Bean的机制。在获取bean的时候,发现是一个普通bean直接返回,如果是一个FactoryBean就调用FactoryBean中的getObject接口返回对应bean。接口public interface FactoryBean<T> { T getObject() throws Exception; Class<?> getObjectT
2017-09-27 19:51:01
298
原创 LeetCode 90. Subsets II
问题描述Given a collection of integers that might contain duplicates, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example, If nums = [1,2,2], a solution
2017-09-26 12:00:50
663
原创 LeetCode 78. Subsets
问题描述Given a set of distinct integers, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example, If nums = [1,2,3], a solution is: [ [3], [1],
2017-09-24 18:50:48
260
原创 LeetCode 289. Game of Life
问题描述According to the Wikipedia’s article: “The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.”Given a board with m by
2017-09-24 14:55:56
228
原创 LeetCode 79. 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 those horizontally or vertically
2017-09-23 12:31:37
225
原创 LeetCode 153. Find Minimum 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).Find the minimum element.You may assume no duplicate e
2017-09-22 10:21:11
235
原创 LeetCode 670. Maximum Swap
问题描述Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get.Example 1: Input: 2736 Output: 7236 Exp
2017-09-21 17:18:18
484
原创 LeetCode 81. Search in Rotated Sorted Array II
问题描述 Follow up for “Search in Rotated Sorted Array”: What if duplicates are allowed? Would this affect the run-time complexity? How and why?Suppose an array sorted in ascending order is rota
2017-09-19 17:46:02
351
原创 LeetCode 80. Remove Duplicates from Sorted Array II
问题描述Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice?For example, Given sorted array nums = [1,1,1,2,2,3],Your function should return length = 5, with the first five el
2017-09-18 20:09:09
448
原创 LeetCode 485. Max Consecutive Ones
问题描述Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last three digits are cons
2017-09-17 16:15:10
234
原创 LeetCode 448. Find All Numbers Disappeared in an Array
问题描述Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in this array.Could
2017-09-17 15:05:11
199
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人