自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Just Do It!

努力到无能为力,拼搏到感动自己

  • 博客(29)
  • 资源 (2)
  • 收藏
  • 关注

原创 LeetCode总结二维矩阵问题

二维矩阵旋转90度题目:https://leetcode.com/problems/rotate-image/武器:分解步骤顺时针旋转90度:交换对称元素,例子中以1 5 9 为轴交换,然后反转每一行逆时针旋转90度:交换对称元素,例子中以1 5 9 为轴交换,然后反转每一列结果:思路通过Search a 2D Matrix II题目:https://leetc...

2019-01-24 17:48:16 1174

原创 LeetCode总结动态规划类题目

爬楼梯题目:https://leetcode.com/problems/climbing-stairs/武器: 分解问题,从1,2,3开始,写出转换方程dp[i]=dp[i-1]+dp[i-2];结果:一次通过最大连续子数组和题目:https://leetcode.com/problems/maximum-subarray/武器:动态规划结果:一次通过抢劫最大金额...

2019-01-18 15:42:45 765

原创 LeetCode总结数学转换类题目

罗马字符转换为数字题目:https://leetcode.com/problems/roman-to-integer/武器:抓住关键点,L,X,C三种减法的情况,其他都为加法结果:一次通过Excel列转换为数字题目:https://leetcode.com/problems/excel-sheet-column-number/武器:找出规律,比如BZ,('B'-'A'+1)...

2019-01-17 14:15:01 535

原创 一片文章说明白分布式系统NRW,Paxos,Raft

引言今天看到一篇文章提高分布式系统中service宕机的问题,其中作者提到了分布式系统中的一个基本问题。假如有两个service A和B,每个service当然有很多instance。如果A调用B进行数据更新操作,B在接受后未处理前宕机了,怎么办?数据丢失了怎么办?我们从系统架构的演进来梳理一下各个架构时代这个问题的处理方法单节点时期最早的架构很简单,都是单节点。所有请求都由一个节...

2019-01-17 11:39:42 701

原创 LeetCode总结单链表相关题目

反转单链表题目:https://leetcode.com/problems/reverse-linked-list/武器:反转时候记录pre,nextTmp处理结果:一次通过合并两个有序链表题目:https://leetcode.com/problems/merge-two-sorted-lists/武器:遍历单链表结果:完美通过,有个小bug,比较两个元素大小,添加到...

2019-01-16 17:47:50 388

原创 LeetCode总结整型数组类题目

寻找唯一的单个数题目:https://leetcode.com/problems/single-number/武器:利用map计算次数,线性时间。但是需要O(n)存储空间结果:未通过新武器:XOR操作异或的运算方法是一个二进制运算:1^1=00^0=01^0=10^1=1两者相等为0,不等为1.(1) a ^ b = b ^ a;(2) (a ^ b)...

2019-01-16 16:52:47 461

原创 LeetCode总结二叉树类题目

二叉树最大深度题目:https://leetcode.com/problems/maximum-depth-of-binary-tree/武器:二叉树,不是BST。思路一样。既然是深度,利用BFS,因为广度优先搜索是每层扫描的。结果:一次通过有序数组构建平衡二叉树题目:https://leetcode.com/problems/convert-sorted-array-to-b...

2019-01-16 16:29:11 647

原创 LeetCode总结字符串操作类题目

反转字符串题目:https://leetcode.com/problems/reverse-string/武器:两个指针二次结果:一次pass判断是否互为变位词题目:https://leetcode.com/problems/valid-anagram/武器:hashmap统计第一词语每个字符次数,遍历第二个,每个次数减去1,不需要判断是否存在。最后map有不为0,则fal...

2019-01-16 16:21:15 1485

原创 LeetCodeMedium篇Decode Ways

题目A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given anon-emptystring containing only digits, determi...

2019-01-16 11:57:28 221

原创 LeetCodeMEDIM篇3Sum

题目Given an arraynumsofnintegers, are there elementsa,b,cinnumssuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not ...

2019-01-15 11:44:59 240

原创 LeetCodeMEDIM篇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 keysless thanthe node's key. ...

2019-01-14 16:17:43 245

原创 LeetCodeMedium篇Maximum Product Subarray

题目Given an integer arraynums, find the contiguous subarray within an array (containing at least one number) which has the largest product.Example 1:Input: [2,3,-2,4]Output: 6Explanation:[2,...

2019-01-11 18:52:19 250

原创 LeetCodeMedium篇Coin Change

题目You are given coins of different denominations and a total amount of moneyamount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of mo...

2019-01-11 17:33:22 222

原创 LeetCodeMEDIM篇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 vertical...

2019-01-11 15:49:45 280

原创 LeetCodeMEDIM篇Evaluate Reverse Polish Notation

题目Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.Note:Division between two integ...

2019-01-09 20:01:26 241

原创 LeetCodeMEDIM篇Basic Calculator II

题目Implement a basic calculator to evaluate a simple expression string.The expression string contains onlynon-negativeintegers,+,-,*,/operators and empty spaces. The integer division should...

2019-01-09 19:38:19 240

原创 LeetCodeMEDIM篇Search 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]).You are given a target value to search. If fo...

2019-01-09 18:48:33 197

原创 LeetCodeMEDIM篇 Find First and Last Position of Element in Sorted Array

题目Given an array of integersnumssorted in ascending order, find the starting and ending position of a giventargetvalue.Your algorithm's runtime complexity must be in the order ofO(logn).If...

2019-01-08 15:20:25 258

原创 LeetCodeMEDIM篇Course Schedule II

题目There are a total ofncourses you have to take, labeled from0ton-1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a ...

2019-01-08 12:16:38 289

原创 LeetCodeMEDIM篇 Sort List

题目Sort a linked list inO(nlogn) time using constant space complexity.Example 1:Input: 4->2->1->3Output: 1->2->3->4Example 2:Input: -1->5->3->4->0Output:...

2019-01-08 11:18:39 245

原创 LeetCodeMEDIM篇Word Break

题目Given anon-emptystringsand a dictionarywordDictcontaining a list ofnon-emptywords, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.Note:...

2019-01-07 20:01:39 304 1

原创 LeetCodeMedium篇 Remove Nth Node From End of List

题目Given a linked list, remove then-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the en...

2019-01-04 15:35:48 168

原创 LeetCodeMedium篇Lowest Common Ancestor of a Binary Tree

题目Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest common ancestor is defined between two node...

2019-01-04 10:14:01 147

原创 LeetCodeMedium篇Merge Intervals

题目Given a collection of intervals, merge all overlapping intervals.Example 1:Input: [[1,3],[2,6],[8,10],[15,18]]Output: [[1,6],[8,10],[15,18]]Explanation: Since intervals [1,3] and [2,6] over...

2019-01-03 19:41:30 139

原创 LeetCodeMEDIM篇Implement Trie (Prefix Tree)

题目Implement a trie withinsert,search, andstartsWithmethods.Example:Trie trie = new Trie();trie.insert("apple");trie.search("apple"); // returns truetrie.search("app"); // returns ...

2019-01-03 16:55:04 221

原创 LeetCodeMedium篇Course Schedule

题目There are a total ofncourses you have to take, labeled from0ton-1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a ...

2019-01-03 11:40:14 240

原创 LeetCodeMedium篇Construct Binary Tree from Preorder and Inorder Traversal

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

2019-01-02 15:35:10 134

原创 LeetCodeMedium篇 Set Matrix Zeroes

题目Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do itin-place.Example 1:Input: [ [1,1,1], [1,0,1], [1,1,1]]Output: [ [1,0,1], [0,0,0], [1,0,1]]...

2019-01-02 14:39:43 194

原创 LeetCodeMedium篇Palindrome Partitioning

题目Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.Example:Input:"aab"Output:[ ["aa","b"], ["a"...

2019-01-02 10:43:14 201

Spring AMQP 集成完整代码,可运行

Spring AMQP实例 以及Spring 配置文件动态注入属性使用实战

2015-02-04

java排序算法

排序算法的java和c实现,有思路有代码,值得学习!!!

2012-04-15

空空如也

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

TA关注的人

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