Problem DescriptionThere must be many A + B problems in our HDOJ , now a new one is coming.Give you two hexadecimal integers , your task is to calcula...
分类:
其他好文 时间:
2015-07-05 16:23:22
阅读次数:
125
https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/Remove Duplicates from Sorted Array IIFollow up for "Remove Duplicates":What if d...
分类:
编程语言 时间:
2015-07-05 12:19:38
阅读次数:
131
https://leetcode.com/problems/merge-sorted-array/Merge Sorted ArrayGiven two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted arra...
分类:
编程语言 时间:
2015-07-05 12:19:06
阅读次数:
127
https://leetcode.com/problems/remove-duplicates-from-sorted-array/Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in pl...
分类:
编程语言 时间:
2015-07-05 10:59:32
阅读次数:
118
转载请注明本文地址:http://blog.csdn.net/yangnanhai93
Leetcode题目链接地址:https://leetcode.com/problems/container-with-most-water/
暴力的方式还是很简单的,O(n^2)可以完成,任意两个的组合都是可以解决这个问题的,但是,仔细想想,可以发现,题目还是有规律的。
算法的思路是选择...
分类:
其他好文 时间:
2015-07-05 09:46:32
阅读次数:
96
题目出处:https://leetcode.com/problems/palindrome-number/
题目:Determine whether an integer is a palindrome. Do this without extra space.
翻译:判断一个整型数是否是回文数
思路:将整型数转化为字符串,依次比较首尾
代码:
public class Solution...
分类:
其他好文 时间:
2015-07-04 14:08:01
阅读次数:
171
Path Sum :https://leetcode.com/problems/path-sum/
解析:求根到叶节点路径上所有节点的和等于target的值
即判断是否存在 一个叶节点的值等于target;如何判断一个节点是叶节点:该节点本身非空,左右节点为空。/**
* Definition for a binary tree node.
* struct TreeNode {
*...
分类:
其他好文 时间:
2015-07-03 17:33:57
阅读次数:
109
Path Sum II : https://leetcode.com/problems/path-sum-ii/
解析:
和上一题的区别就是,要记录所有能满足条件的路径。
要保存当前的结果,并且每次递归后都要恢复递归前的结果;每当递归到叶子节点时,判断是否需要当前结果(path)保存下来。
叶节点时 sum == 0, 保存当前结果,然后逐步恢复递归前结果
叶节点时 sum != 0,不保...
分类:
其他好文 时间:
2015-07-03 17:29:20
阅读次数:
115
Balanced Binary Tree : https://leetcode.com/problems/balanced-binary-tree/given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary...
分类:
其他好文 时间:
2015-07-03 15:51:33
阅读次数:
118
8 String to Integer (atoi)链接:https://leetcode.com/problems/string-to-integer-atoi/
问题描述:
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you wa...
分类:
其他好文 时间:
2015-07-03 14:03:32
阅读次数:
105