上一页 1 2 3 4 5 6 7 ··· 12 下一页
摘要: Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.Solution:public class Solution { public S... 阅读全文
posted @ 2014-04-24 22:21 xchangcheng 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.Solution:class Solution {public: int roma... 阅读全文
posted @ 2014-04-24 22:18 xchangcheng 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t... 阅读全文
posted @ 2014-04-24 22:11 xchangcheng 阅读(171) 评论(0) 推荐(0) 编辑
摘要: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu... 阅读全文
posted @ 2014-04-18 19:10 xchangcheng 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For exam... 阅读全文
posted @ 2014-04-18 14:37 xchangcheng 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.Solution:/** * Definition for a point. * struct Point... 阅读全文
posted @ 2014-04-17 20:30 xchangcheng 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.Notes:It is intended for this problem to be specified vaguely (ie, no given input specs). You are respo 阅读全文
posted @ 2014-04-01 22:23 xchangcheng 阅读(236) 评论(0) 推荐(0) 编辑
摘要: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the length of 1.S 阅读全文
posted @ 2014-04-01 21:45 xchangcheng 阅读(214) 评论(0) 推荐(0) 编辑
摘要: // int[,] label = new int[m, n]; Parallel.For(0, thread_num, (n) => { for (int i = switchPoint[n]; i < switchPoint[n + 1]; i++) { int[] tmp = new int[n]; } });空间开在并行块之外远远快于开在循环块之内。不确定是否是因为线程之间的竞争~~ 阅读全文
posted @ 2014-03-27 21:21 xchangcheng 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 unique BST's shown below. 1 3 3 2 1 \ / / / \ \ 3 2 1 1 3 2 / / \ ... 阅读全文
posted @ 2014-03-24 09:41 xchangcheng 阅读(154) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 12 下一页