自定义博客皮肤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!

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

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

原创 LeetCodeMedium篇Number of Islands

题目Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may as...

2018-12-29 17:14:22 212

原创 LeetCodeMedium篇Increasing Triplet Subsequence

题目Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.Formally the function should:Return true if there existsi, j, ksuch thatarr[i]<...

2018-12-29 15:47:37 174

原创 LeetCodeMedium篇Letter Combinations of a Phone Number

题目Given a string containing digits from2-9inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is...

2018-12-28 17:50:23 254

原创 LeetCodeMedium篇Binary Tree Zigzag Level Order Traversal

题目Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For example:Given binary...

2018-12-28 16:43:17 161

原创 LeetCodeMedium篇 Perfect Squares

题目Given a positive integern, find the least number of perfect square numbers (for example,1, 4, 9, 16, ...) which sum ton.Example 1:Input: n = 12Output: 3 Explanation: 12 = 4 + 4 + 4.Exa...

2018-12-28 15:53:02 260

原创 LeetCodeMedium篇Kth Smallest Element in a Sorted Matrix

题目Given anxnmatrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.Note that it is the kth smallest element in the sorted order, n...

2018-12-28 14:17:31 148

原创 LeetCode刷题Medium篇Search a 2D Matrix II

题目Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right. Integers in ...

2018-12-28 11:53:57 189

原创 LeetCodeMedium篇Longest Increasing Subsequence

题目Given an unsorted array of integers, find the length of longest increasing subsequence.Example:Input: [10,9,2,5,3,7,101,18]Output: 4 Explanation: The longest increasing subsequence is [2,3,...

2018-12-27 18:41:14 190

原创 LeetCodeMedium篇Find Peak Element

题目A peak element is an element that is greater than its neighbors.Given an input arraynums, wherenums[i] ≠ nums[i+1], find a peak element and return its index.The array may contain multiple pe...

2018-12-27 16:49:32 240

原创 LeetCode刷题Medium篇Container With Most Water

题目Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find...

2018-12-27 15:18:35 223

原创 LeetCode刷题Medium篇Insert Delete GetRandom O(1)

题目Design a data structure that supports all following operations in average O(1) time. insert(val): Inserts an item val to the set if not already present. remove(val): Removes an item val from ...

2018-12-26 18:45:03 218

原创 LeetCode刷题Medium篇Group Anagrams

题目Given an array of strings, group anagrams together.Example:Input: ["eat", "tea", "tan", "ate", "nat", "bat"],Output:[ ["ate","eat","tea"], ["nat&q

2018-12-26 14:03:04 258

原创 LeetCodeMEDIM篇Kth Largest Element in an Array

题目Find thekth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.Example 1:Input: [3,2,1,5,6,4] and k = 2Output: 5...

2018-12-25 18:07:40 221

原创 LeetCodeMedium篇Unique Paths---动态规划

题目A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach th...

2018-12-25 16:42:24 202

原创 LeetCode刷题Medium篇Rotate Image

题目You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note:You have to rotate the image in-place, which means you have to modify the input 2D matr...

2018-12-25 12:18:29 199

原创 LeetCode刷题Medium篇 Binary Tree Level Order Traversal

题目这个题目以前做过,其实就是BFS,以前的题目是从下往上记录,这个结果要求从上往下记录。题目如下:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary t...

2018-12-24 18:59:36 197

原创 LeetCode刷题Medium篇 Find the Duplicate Number

题目Given an array nums containing n + 1 integers where each integer is between 1 and n(inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number,...

2018-12-24 18:31:54 261 3

原创 LeetCode刷题Medium篇Linked List Cycle II

题目Given a linked list, return the node where the cycle begins. If there is no cycle, return null.To represent a cycle in the given linked list, we use an integer pos which represents the position ...

2018-12-24 18:12:25 262 2

原创 LeetCode刷题Medium篇Odd Even Linked Lis

题目Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do it ...

2018-12-24 17:11:10 187

原创 LeetCode刷题Medium篇 Kth Smallest Element in a Sorted Matrix

题目Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.Note that it is the kth smallest element in the sorted order, n...

2018-12-24 16:45:59 172

原创 LeetCode刷题Medium篇Kth Smallest Element in a BST

题目Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements.Example 1:Input: root =...

2018-12-24 11:29:46 187

原创 LeetCode刷题Medium篇Shuffle an Array

题目Shuffle a set of numbers without duplicates.Example:// Init an array with set 1, 2, and 3.int[] nums = {1,2,3};Solution solution = new Solution(nums);// Shuffle the array [1,2,3] and retu...

2018-12-24 10:51:57 181

原创 LeetCode刷题Medium篇4SumII

题目Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make problem a bit easier, all A, B, C, D have same l...

2018-12-21 17:48:26 223

原创 LeetCode刷题Medium篇 Subsets

题目Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.Example:Input: nums = [1,2,3]Output:[ [3],...

2018-12-21 16:23:07 184

原创 LeetCode刷题Medium篇Generate Parentheses

题目Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(...

2018-12-21 15:09:27 188

原创 LeetCode刷题Medium篇Permutations全排列----回溯法backtracking

题目Given a collection of distinct integers, return all possible permutations.Example:Input: [1,2,3]Output:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]注意,不同的整数,相同可能有变化...

2018-12-21 12:10:11 276

原创 LeetCode刷题Medium篇Top K Frequent Elements

题目Given a non-empty array of integers, return the k most frequent elements.Example 1:Input: nums = [1,1,1,2,2,3], k = 2Output: [1,2]Example 2:Input: nums = [1], k = 1Output: [1]Note:...

2018-12-20 14:51:52 217

原创 LeetCode刷题MEDIM篇Product of Array Except Self

题目Given an array nums of n integers where n &gt; 1,  return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Example:Input: [1,2,3,4]Outp...

2018-12-20 11:50:19 191

原创 LeetCode刷题Medium篇Zigzag Conversion

题目The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S...

2018-12-19 15:49:13 232

原创 LeetCode刷题Easy篇 Nim Game

题目You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be...

2018-12-19 11:43:06 220

原创 LeetCode刷题Easy篇Word Pattern

题目Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str.Ex...

2018-12-19 11:33:31 204

原创 LeetCode刷题Easy篇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.Example:Input: [0,1,0,3,12]Output: [1,3,12,0,0]Note:Y...

2018-12-19 11:04:35 151

原创 LeetCode刷题Easy篇First Bad Version

题目You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on...

2018-12-18 19:26:46 240

原创 LeetCode刷题Easy篇Missing Number

题目Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.Example 1:Input: [3,0,1]Output: 2Example 2:Input: [9,6,4,2,3,5,7,0,...

2018-12-18 11:47:52 183

原创 LeetCode刷题Easy篇 Add Digits

题目Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.Example:Input: 38Output: 2 Explanation: The process is like: 3 + 8 = 11, 1 + 1 = 2.   ...

2018-12-18 10:57:25 171

原创 LeetCode刷题Easy篇Binary Tree Paths

题目Given a binary tree, return all root-to-leaf paths.Note: A leaf is a node with no children.Example:Input: 1 / \2 3 \ 5Output: ["1-&gt;2-&gt;5", "1-&gt;3"]Explanation: All...

2018-12-18 10:41:22 176

原创 LeetCode刷题Easy篇.Valid Anagram

题目Given two strings s and t , write a function to determine if t is an anagram of s.Example 1:Input: s = "anagram", t = "nagaram"Output: trueExample 2:Input: s = "rat", t = "car"Output:...

2018-12-14 15:48:15 194

原创 LeetCode刷题Easy篇删除单链表中的元素Delete Node in a Linked List

题目Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Given linked list -- head = [4,5,1,9], which looks like following: 4 -&gt; 5 -&g...

2018-12-14 15:06:07 234

原创 LeetCode刷题Easy篇.Lowest Common Ancestor of a Binary Search Tree

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

2018-12-14 11:33:59 178

原创 LeetCode刷题Easy篇. Palindrome Linked List

题目Given a singly linked list, determine if it is a palindrome.Example 1:Input: 1-&gt;2Output: falseExample 2:Input: 1-&gt;2-&gt;2-&gt;1Output: trueFollow up:Could you do it in O(n) ti...

2018-12-13 18:02:38 209

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

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

2015-02-04

java排序算法

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

2012-04-15

空空如也

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

TA关注的人

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