自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 资源 (1)
  • 收藏
  • 关注

原创 415. Add Strings

Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.Note:The length of both num1 and num2 is Both num1 and num2 contains only digits 0-9.Bo

2018-01-22 05:55:16 234

原创 482. License Key Formatting

You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes.Given a number K, we would want to

2018-01-22 05:15:25 253

原创 38. Count and Say

The count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211 is read off as "one 1" or 11.11 is read o

2018-01-20 06:00:23 200

原创 232. Implement Queue using Stacks

Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front element.empty(

2018-01-20 05:17:35 177

原创 225. Implement Stack using Queues

Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element.empty() -- Return whet

2018-01-20 05:07:08 183

原创 695. Max Area of Island

Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are su

2017-10-10 05:41:39 170

原创 693. Binary Number with Alternating Bits

Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.Example 1:Input: 5Output: TrueExplanation:The binary represen

2017-10-10 05:00:01 225

原创 680. Valid Palindrome II

Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome.Example 1:Input: "aba"Output: TrueExample 2:Input: "abca"Output: TrueEx

2017-09-30 23:59:25 256

原创 690. Employee Importance

You are given a data structure of employee information, which includes the employee's unique id, his importance value and his direct subordinates' id.For example, employee 1 is the leader of emp

2017-09-30 04:12:26 297

原创 557. Reverse Words in a String III

Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: "Let's take LeetCode contes

2017-09-30 01:23:41 144

原创 657. Judge Route Circle

Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place.The move sequence is represented

2017-09-30 00:59:53 162

原创 Fragment之间消息传递

Google官方文档上说:为了让fragments更模块化,Fragments之间不要进行直接的交互,可以使用接口的方法。 In order to reuse the Fragment UI components, you should build each as a completely self-contained, modular component that defines i

2017-08-16 13:38:26 3107

原创 算法导论9.1 最大值和最小值

情景:对于一个数组,同时求出其最大值和最小值。分析:方法1:将最大值和最小值设置为第一个元素,依次比较剩下的元素,需要比较 2 (n - 1) 次;方法2主要思路为成对比较。取出相邻两个元素,比较大小,然后将较小值和最小值比较,将较大值和最大值比较,如此一对元素需要进行三次比较。最大值和最小值的初始化和数组长度奇偶相关:如果数组长度为奇数,将最大值和最小值设

2017-08-06 04:03:41 1774

原创 606. Construct String from Binary Tree

You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way.The null node needs to be represented by empty parenthesis pair "()". And you

2017-07-26 23:31:10 711

原创 257. Binary Tree Paths

Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3"]使用DFS,因

2017-07-22 01:15:30 164

原创 Android Activity和Fragment生命周期

写在前边:感觉要暂时放弃自己钟爱的computer graphics转战安卓开发了,心里还是有一点不开心。。。。但是我不会放弃CG的!!想要把自己平时积累的知识记录下来,以便将来回来看看,同时也希望能帮到有需要的人。正文:在Android中,activity和fragment的生命周期一直很繁琐,有时候也是傻傻分不清楚,先贴两张图,分别对应activity和fragment的生命周

2017-07-20 23:46:12 2825

原创 309. Best Time to Buy and Sell Stock with Cooldown

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

2017-03-21 07:09:16 182

原创 188. Best Time to Buy and Sell Stock IV

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 k transactions.Note:You may no

2017-03-21 05:39:35 260

原创 44. Wildcard Matching

Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching should cover t

2017-03-17 05:46:03 353

原创 105. 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.这道题是利用一棵树的先序遍历,和中序遍历重建出一颗树,LeetCode中有一道相似的题目:106. Const

2017-03-17 01:17:21 323

原创 124. Binary Tree Maximum Path Sum

Given a binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The

2017-03-16 11:24:19 223

原创 461. Hamming Distance

The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.Note:0 ≤ x, 

2017-03-16 10:02:57 265

原创 300. Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is [2, 3, 7, 101], ther

2017-03-16 07:24:13 198

原创 74. Search a 2D Matrix

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 from left to right.The first integer of each

2017-03-15 08:54:27 210

原创 c++ STL 容器之 map

这篇文章主要对比map, multimap, unordered map和unordered multimap.当我们发现某两个数据之间成对存在,并彼此关联,就可以用map这种容器来存放这对数据,根据是否需要元素有序,和key值是否可以重复来选择不同的容器。如果需要储存的元素是有序的,就要选择map,如果不需要元素有序,就可以选择onordered_map。 使用map的时候,通过key值

2016-11-14 03:37:50 595

原创 23. Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.ExampleGiven lists:[ 2->4->null, null, -1->null],return -1->2->4->null.Note: 题

2016-10-03 04:38:00 265

原创 143. Reorder List

关于链表问题,个人总结了几个考点,可以作为解题思路,今后也会补充。1. 找到链表的中点,可以使用快慢指针。2. 单链表翻转。3. 两个链表合并。-----------------------------------单链表中点------------------------------------------------------------------------

2016-09-26 01:10:16 231

原创 148. Sort List

Sort a linked list in O(n log n) time using constant space complexity.ExampleGiven 1->3->2->null, sort it to 1->2->3->null.-----------------------------------------------------------------

2016-09-19 02:41:33 305

空空如也

空空如也

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

TA关注的人

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