题目:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the....
分类:
编程语言 时间:
2014-07-21 11:14:07
阅读次数:
203
maven中手动去更新jar包,是一件比较繁琐麻烦的事情,使用Range Dependency则可以省去这一步骤。 部分jar包可能会自动升级到beat版本! 官方说明文档:Dependency Version Ranges Range Meaning (...
分类:
其他好文 时间:
2014-07-21 10:30:10
阅读次数:
243
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.题解:转换的方法:从左往右扫描罗马字符,如果当前的字符对应的数字比上一个数字小,就直接加...
分类:
其他好文 时间:
2014-07-21 10:05:42
阅读次数:
223
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.题解:基本的罗马字符和数字对应如下表所示:罗马字符数字I1V5X10L50C100D50...
分类:
其他好文 时间:
2014-07-21 10:05:16
阅读次数:
286
Remove Duplicates from Sorted List IIGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the or...
分类:
其他好文 时间:
2014-07-21 09:33:03
阅读次数:
218
equal_range(应用于有序区间)
--------------------------------------------------------------------------------------------------------------------------------------
描述:利用二分查找找到一个区间,区间里的所有值都等于给定值,返回的是一个pair,
分别存储区间的上界迭代器和下界迭代器
源码:
template <class ForwardIterator, c...
分类:
其他好文 时间:
2014-07-20 23:06:36
阅读次数:
263
简单的二叉树的先根遍历模板的应用
class Solution:
# @param root, a tree node
# @return an integer
def hehe(self, num, root):
#再原来的基础上*10,再加上当前的root.val
num = num * 10 + root.val
...
分类:
其他好文 时间:
2014-07-20 22:45:33
阅读次数:
299
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2014-07-20 21:32:55
阅读次数:
250
Problem Description
An equal sum partition of a sequence of numbers is a grouping of the numbers (in the same order as the original sequence) in such a way that each group has the same sum. For examp...
分类:
其他好文 时间:
2014-07-20 15:42:42
阅读次数:
256
问题1:假设我们知道汉字编码范围是0x4E00到0x9FA5,怎么从十六进制的编码转成人类可读的字呢?
问题2:怎么把unicode编码的字写入文件呢,如果直接用open()的话,会提示UnicodeEncodeError: 'ascii' codec can't encode character u'\u4e00' in position 0: ordinal not in range(128...
分类:
编程语言 时间:
2014-07-20 10:46:08
阅读次数:
732