- 博客(19)
- 收藏
- 关注
原创 LeetCode.106 Construct Binary Tree from Inorder and Postorder Traversal
106. Construct Binary Tree from Inorder and Postorder TraversalGiven inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist i
2017-10-19 14:39:10
216
原创 C++简单实现贪吃蛇小游戏(console)
学习C++过程中做的一个小程序,比较简单,只实现了贪吃蛇小游戏最基本的功能。上传代码作为学习的记录,同时也为其他同学提供作为一个小小的参考。#include #include #include #include #include #include using namespace std;/*1.24x24格子2.初始length = 43.floor[][][0](
2017-10-11 14:11:46
1666
1
原创 LeetCode.102 Binary Tree Level Order Traversal
102. Binary Tree Level Order TraversalGiven a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree [3,9,
2017-09-26 11:37:29
178
原创 LeetCode.338 Counting Bits
338. Counting BitsGiven a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.
2017-09-20 15:38:49
227
原创 LeetCode.477 Total Hamming Distance
477. Total Hamming DistanceThe Hamming distance between two integers is the number of positions at which the corresponding bits are different.Now your job is to find the total Hamming dist
2017-09-18 14:47:30
381
原创 LeetCode.45 Jump Game II
45. Jump Game IIGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that po
2017-09-18 10:11:50
399
原创 LeetCode.1 Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same
2017-09-14 11:43:41
143
原创 LeetCode.154 Find Minimum in Rotated Sorted Array II
154. Find Minimum in Rotated Sorted Array IIFollow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?
2017-09-14 10:58:39
154
原创 LeetCode.153
153. Find Minimum in Rotated Sorted ArraySuppose 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).
2017-09-13 16:00:25
202
原创 LeetCode.33
Search in Rotated Sorted ArraySuppose 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
2017-09-13 15:37:20
183
原创 LeetCode.64
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at
2017-09-13 10:05:14
181
原创 LeetCode.174
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially p
2017-09-13 08:40:23
273
原创 LeetCode.62
/*A robot is located at the top-left corner of a m x n grid (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 reac
2017-09-07 15:44:37
152
原创 LeetCode.670
/*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: 2736Output: 7236E
2017-09-05 16:59:58
318
原创 LeetCode.168
/*Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -
2017-08-16 23:24:19
188
原创 LeetCode.289
/* 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 wi
2017-08-15 21:17:05
218
原创 归并排序
int* sort(int arr[], int length){ if(length == 1){ return arr; } int* temp_pointer; int lower_length = (length + 1) / 2; int upper_length = length / 2; int lower[lower_length]; int uppe
2017-07-28 00:06:28
156
原创 LeetCode.395
Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than k times.
2017-07-16 14:54:15
258
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人