自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

StarCXDJ的专栏

无他,唯手熟尔

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

转载 MySQL 加锁处理分析

这块一直认知不是很清晰,只知道个大概,直到看到这篇文章背景 MySQL/InnoDB的加锁分析,一直是一个比较困难的话题。我在工作过程中,经常会有同事咨询这方面的问题。同时,微博上也经常会收到MySQL锁相关的私信,让我帮助解决一些死锁的问题。本文,准备就MySQL/InnoDB的加锁问题,展开较为深入的分析与讨论,主要是介绍一种思路,运用此思路,拿到任何一条SQL语句,都能完整的分析出这条语句会...

2018-05-11 11:52:44 220

转载 提升tomcat服务器性能的七条经验

在线上环境中我们是采用了tomcat作为Web服务器,它的处理性能直接关系到用户体验,在平时的工作和学习中,归纳出以下七种调优经验。1. 服务器资源    服务器所能提供CPU、内存、硬盘的性能对处理能力有决定性影响。    (1) 对于高并发情况下会有大量的运算,那么CPU的速度会直接影响到处理速度。    (2) 内存在大量数据处理的情况下,将会有较大的内存容量需求,可

2015-10-10 17:25:15 559

转载 高并发量网站解决方案

一个小型的网站,可以使用最简单的html静态页面就实现了,配合一些图片达到美化效果,所有的页面均存放在一个目录下,这样的网站对系统架构、性能的要求都很简单。随着互联网业务的不断丰富,网站相关的技术经过这些年的发展,已经细分到很细的方方面面,尤其对于大型网站来说,所采用的技术更是涉及面非常广,从硬件到软件、编程语言、数据库、WebServer、防火墙等各个领域都有了很高的要求,已经不是原来简单的ht

2015-10-10 15:43:03 557

原创 [Leetcode] Max Points on a Line (Java)

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.遍历所有点,计算每两个点的斜率k,并用map存放当前固定点此斜率的点的个数;注意可能存在重复点,用dup记录,当前点为1,所以dup初始化为1;注意double类型0.0的表示;与y

2014-02-17 17:58:51 819

原创 [Leetcode] LRU Cache (Java)

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive) of the key if

2014-02-17 16:33:55 839

原创 [Leetcode] Evaluate Reverse Polish Notation (Java)

Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1", "+",

2014-02-17 15:07:49 553

原创 [Leetcode] Sort List (Java)

Sort a linked list in O(n log n) time using constant space complexity.O(n log n)时间复杂度的园地链表排序,归并排序public class Solution { public ListNode sortList(ListNode head) { head = mergeSort(head);

2014-02-17 14:46:28 525

原创 [Leetcode] Insertion Sort List (Java)

Sort a linked list using insertion sort.链表插入排序public class Solution { public ListNode insertionSortList(ListNode head) { ListNode ret = new ListNode(-1); ListNode cur = head

2014-02-17 12:54:53 532

原创 [Leetcode] Reorder List (Java)

Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder it to 

2014-02-17 11:09:29 579

原创 [Leetcode] Word Break II (Java)

Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example, givens = "

2014-02-17 10:34:33 862

原创 [Leetcode] Word Break (Java)

Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"

2014-02-16 16:12:58 942

原创 [Leetcode] Copy List with Random Pointer (Java)

A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.带随机指针的单链表复制先整理成 head->copy

2014-02-15 15:51:51 602

原创 [Leetcode] Candy (Java)

There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least on

2014-02-14 17:16:37 1075

原创 [Leetcode] Gas Station (Java)

There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to

2014-02-14 16:21:34 641

原创 [Leetcode] Clone Graph (Java)

Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.拷贝无向图public class Solution { public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) {

2014-02-14 15:44:00 566

原创 [Leetcode] Palindrome Partitioning II (Java)

Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.For example, given s = "aab",Return

2014-02-14 11:12:33 610

原创 [Leetcode] Palindrome Partitioning (Java)

Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","b"],

2014-02-14 09:54:46 543

原创 [Leetcode] Surrounded Regions (Java)

Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region .For example,X X X XX O O XX

2014-02-13 17:29:35 662

原创 [Leetcode] Word Ladder II (Java)

Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that:Only one letter can be changed at a timeEach intermediate word must exi

2014-02-13 16:09:24 836

原创 [Leetcode] Longest Consecutive Sequence (Java)

Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2, 3

2014-02-12 19:40:06 647

原创 [Leetcode] Sum Root to Leaf Numbers (Java)

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the total

2014-02-12 18:05:33 562

原创 [Leetcode] Binary Tree Postorder Traversal (Java)

Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recursive solut

2014-02-12 17:35:22 553

原创 [Leetcode] Linked List Cycle II (Java)

Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?找到环开始的点同样快慢指针,当相遇时,慢指针回到起点,快指针变成每次一步,他

2014-02-12 17:07:02 548

原创 [Leetcode] Single Number II (Java)

Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without usi

2014-02-12 16:52:54 554

原创 [Leetcode] Binary Tree Preorder Traversal (Java)

Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive soluti

2014-02-12 16:20:38 516

原创 [Leetcode] Linked List Cycle (Java)

Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?快慢指针,1个每次走一步,1个每次走两步,若两指针相遇,说明有环public class Solution { public boolean has

2014-02-12 16:09:20 584

原创 [Leetcode] Word Ladder (Java)

Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter can be changed at a timeEach intermediate word m

2014-02-12 15:30:42 606

原创 [Leetcode] Valid Palindrome (Java)

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a pa

2014-02-12 14:47:50 534

原创 [Leetcode] Binary Tree Maximum Path Sum (Java)

Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 / \ 2 3Return 6.

2014-02-12 14:36:54 728

原创 [Leetcode] Best Time to Buy and Sell Stock III (Java)

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 may

2014-02-12 10:15:19 799

原创 [Leetcode] Best Time to Buy and Sell Stock II (Java)

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 as many transactions as you like (ie, buy on

2014-02-12 09:41:55 618

原创 [Leetcode] Best Time to Buy and Sell Stock (Java)

Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),

2014-02-12 09:21:45 680

原创 [Leetcode] Triangle (Java)

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [

2014-02-11 15:54:56 575

原创 [Leetcode] Pascal's Triangle II (Java)

Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].更新一个数组,并保存每行的前一个元素即可public class Solution { public ArrayList getRow(int rowInd

2014-02-11 11:37:23 558

原创 [Leetcode] Pascal's Triangle (Java)

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]]生成杨辉三角pub

2014-02-11 11:23:29 550

原创 [Leetcode] Populating Next Right Pointers in Each Node II (Java)

Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant extr

2014-02-11 10:35:46 511

原创 [Leetcode] Populating Next Right Pointers in Each Node (Java)

Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node. If t

2014-02-11 10:18:07 560

原创 [Leetcode] Distinct Subsequences (Java)

Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be non

2014-02-11 09:48:53 508

原创 [Leetcode] Flatten Binary Tree to Linked List (Java)

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

2014-01-23 10:29:49 481

原创 [Leetcode] Path Sum II (Java)

Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5 / \

2014-01-23 09:04:02 529

空空如也

空空如也

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

TA关注的人

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