leetCode
布同林
立德立言 无问东西
展开
-
康拓编码——Permutation Sequence
描述2.1.13 Permutation Sequence The set [1,2,3,ĉ ,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, We get the following sequence (ie, for n = ...原创 2018-03-15 20:36:52 · 1380 阅读 · 0 评论 -
LeetCode LRUCache
/*LeetCode LRUCache(least recently used)简单实现Design and implement a data structure for Least Recently Used (LRU) cache. It should support thefollowing operations: get and set.get(key) - Get the va...原创 2018-04-03 15:20:42 · 218 阅读 · 0 评论 -
单链表 环
单链表环转载 2018-04-02 18:46:52 · 151 阅读 · 0 评论 -
Candy
题目2.1.22 Candy 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 ...原创 2018-03-26 15:45:42 · 270 阅读 · 0 评论 -
LeetCode Gas Station
题目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 ...原创 2018-03-22 10:45:34 · 164 阅读 · 0 评论 -
Rotate Image 二维数组旋转
/* 2.1.16 Rotate Image You are given an n × n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place?1 2 3 1 3 4 -> 4 2 二维数组...原创 2018-03-20 20:18:39 · 363 阅读 · 0 评论 -
Next Permutation
备忘/*date: 2018/3/8 10:53des: 2.1.12 Next Permutation Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such ar...原创 2018-03-19 10:08:56 · 139 阅读 · 0 评论 -
Median of Two Sorted Arrays
leetCodebook 2.1.5 Median of Two Sorted Arrays题目描述:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity s...原创 2018-03-19 10:06:49 · 105 阅读 · 0 评论 -
Longest Consecutive Sequence
题目描述2.1.6 Longest Consecutive Sequence 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 con...原创 2018-03-19 10:05:58 · 119 阅读 · 0 评论 -
Permunation-全排列
描述给定一个集合求全排列分析递归递归过程如图 求【a,b,c】的全排列 即求{ a-[b.c]; b-[a,c]; c-[a,b] } 的全排列,依次类推void permunation(int start,int end){ if(end==start)//当start == end 时一次递归结束 return; fo...原创 2018-03-16 20:53:29 · 364 阅读 · 0 评论 -
Trapping Rain Water
描述Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,...原创 2018-03-20 18:51:44 · 116 阅读 · 0 评论 -
Valid Sudoku——九宫格
描述2.1.14 Valid Sudoku Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules http://sudoku.com.au/TheRules.aspx . The Sudoku board could be partially filled, where empty cells a...原创 2018-03-16 17:28:51 · 209 阅读 · 0 评论 -
Single Number
题目2.1.23 Single Number Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you impleme...原创 2018-03-28 17:19:55 · 138 阅读 · 0 评论