由买买提看人间百态

topics

全部话题 - 话题: i1
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
s*****g
发帖数: 731
1
我就是买的i1 display2,挺傻瓜的,装上就成。设定成要完成的色温设置,然后i1的
探头自己贴在屏幕上就帮你一步一步设置成了想要的结果。期间配合显示器自己的调节
按钮调对比度红绿蓝亮度色温等等参数。
这有一个全程的帖子。我用的是台式机LCD,帖子上的是笔记本电脑,步骤过程都是一
样的。
http://bbs.fengniao.com/forum/1190890.html
m*z
发帖数: 3102
2
请万佛帮忙看下X-Rite i1 Display LT $69.99 不知这个好不好?谢谢~
http://www.newegg.com/Product/Product.aspx?Item=N82E16832699001
With Promo Code
EMCJHKA55
===============================
X-Rite i1 Display 2 software多了2个Advanced Mode~还是等Display 2 onsale 买好了~
g*****n
发帖数: 21539
3
i1 display pro
大概200块, 可以校正LED monitor, 其他老的东西只能校正LCD
而且i1 display pro可以每十分钟根据环境光自动调整
z****n
发帖数: 1627
4
来自主题: PhotoGear版 - i1 display2和红蜘蛛咋选
我用的绿蜘蛛+红蜘蛛的软件(你懂的。。。) 现在蜘蛛3代好像不能这么用了。
感觉i1配的软件似乎功能多一些。这两个的硬件上区别有多大还真不太清楚。
s*****g
发帖数: 731
5
今天定的i1 display2到了,很高兴的调了一下显示器,差别很大。初次设定时按照色
温6500K,gamma2.2,亮度120调的。调完效果很明显,但使用时间稍长后觉得恶心想吐
,也不知道是因为吃火锅的问题还是校色后不适应。所以想问问大家,大家都是按多少
色温调显示器的啊。比如为了保证送到店里里打印出来的相片跟自己在屏幕上看的效果
一致该多少色温。又或者保证在其他人的电脑上看到的修改后的照片跟自己调过的电脑
上看着效果相近又该多少度。
我前后按两种模式调了下,第一次就是刚说的6500K,第二次按照所谓的“当前色温”
调的,结果在屏幕的亮度对比度和色温等等方面两次设置都有不少区别。
z*******5
发帖数: 2990
6
来自主题: PhotoGear版 - i1校色
i1 basic现在不支持mac最新系统了,他们会更新程序么?
用LCD的程序矫正LED的显示器会有什么样的问题?
有其他什么校色仪可以支持现在mac系统呢?
p**m
发帖数: 3876
7
这个是 10:30开始
http://www.amazon.com/b/ref=gb_countdown_link?_encoding=UTF8&no
Upcoming Deal
X-Rite i1 EOPHO Photo Pro
Deal starts at
10:30 AM PST in 00h 48m 45s

simulator
g******y
发帖数: 2517
8
14k Yellow Gold Oval Pave Diamond Hoop Earrings (1/4 cttw, H-I Color, I1-I2
Clarity), 半价
http://amzn.to/yzkrj1
g******y
发帖数: 2517
9
14k Yellow Gold Channel-Set Diamond Hoop Earrings (1/3 cttw, H-I Color, I1-
I2 Clarity), 51% Off
http://amzn.to/yD3qDm
g******y
发帖数: 2517
10
Women's 14k White Gold Engagement Ring (1/4 cttw I-J Color, I1-I2 Clarity),
70% Off
http://amzn.to/yO0mIF
i**********e
发帖数: 1145
11
谢谢你们的尝试,我又尝试了一个方案,但还是不能证明worst case的upper bound是O
(N).
思路是这样的:
假设矩阵的大小是 NxM,那么总共有 NxM 个元素。每一次划分可以保证去除正好 NM/2
个元素。第二层的划分又可以保证去除 NM/4 个元素。那么最坏的情况我们可以保证
划分的层数绝对不会超过 lg (NM)。这也表示 recursion 的深度不会超过 lg (NM)。
第一层我们总共用了 lg N 的时间来去除 NM/2 个元素,剩下 NM/2 个元素来搜索。
第二层我们总共用了 lg(i1) + lg(N-i1) 的时间来去除 NM/4 个元素,剩下 NM/4 个
元素。(i1 是第二层选择的划分点)
Complexity:
1st level = lg (N), NM/2 items left
2nd level = lg(i1) + lg(N-i1), NM/4 items left
3rd level = lg(i2) + lg(i1-i2) + lg(i3) + lg(N-i1-i3), NM/8 items left... 阅读全帖
j*******o
发帖数: 34
12
#include "stdlib.h"
#include "iostream.h"
int main(void)
{
int n1=1, n2=2, n3=3, n4=4, ****arr4=new int ***[n1];
for (int i1=0;i1 arr4[i1]=new int **[n2];
for (int i2=0;i2 arr4[i1][i2]=new int *[n3];
for (int i3=0;i3 arr4[i1][i2][i3]=new int [n4];
for (int i4=0;i4 arr4[i1][i2][i3][i4]=rand();
}
}
}
}
for (int i1=0;i1 for (int i2=0;i2 for (int i3=0;i3阅读全帖
w******p
发帖数: 166
13
来自主题: JobHunting版 - 经典面试题
http://en.wikipedia.org/wiki/Multiplication_algorithm
an implementation of the "lattice mul":
#include
#include
void box(const char* v1, const char* v2)
{
size_t len1 = strlen(v1);
size_t len2 = strlen(v2);
size_t lres = len1 + len2;
char res[lres+1];
size_t i1, i2;
for (i1 = 0; i1 < lres; i1 ++)
res[i1] = 0;
res[lres] = '\0';
for (i1 = 0; i1 < len1; i1 ++)
for (i2 = 0; i2 < len2; i2 ++)
{
int int1 = (int) (v1[len1-1-i1... 阅读全帖
b*****e
发帖数: 474
14
来自主题: JobHunting版 - 讨论一道面试题
前提和 flydog MM 的一样, 用C++:
#include
#include
#include
using namespace std;
int has_conflict(vector >& s1, int i1,
vector >& s2, int i2) {
if ( s1[i1].first <= s2[i2].first && s2[i2].first < s1[i1].second
|| s2[i2].first <= s1[i1].first && s1[i1].first < s2[i2].second )
return 1;
return 0;
}
void print_conflict(vector >& s1, int i1,
vector >& s2, int i2) {
cout << "confli... 阅读全帖
k***t
发帖数: 276
15
Good explanation! Very straightforward.
What about next_combination()? There is some code online, no straightforward
explanation though.
http://stackoverflow.com/questions/127704/algorithm-to-return-a
template
bool next_combination(const Iterator first, Iterator k, const Iterator last)
{
/* Credits: Mark Nelson http://marknelson.us */
if ((first == last) || (first == k) || (last == k))
return false;
Iterator i1 = first;
Iterator i2 = last;
++i1;
if (la... 阅读全帖
A*H
发帖数: 127
16
来自主题: JobHunting版 - Leetcode Timeout
是一定code有问题么,还是有可能程序跑得不够快?
wildcard matching 那题,small test 过了,large test 一直timeout, 大家帮忙看
看这个java code有什么问题么? 除了暴力法,还有更快得解法么?
public boolean isMatch(String s, String p) {
return match(s, p, 0, 0);
}
public boolean match(String s1, String s2, int i1, int i2) {
int l1 = s1.length();
int l2 = s2.length();
if (i2 == l2) return i1 == l1;
if (s2.charAt(i2) == '*') {
while (i2 i2++; // find next n... 阅读全帖
z****p
发帖数: 18
17
Sorry, I didn't read the problem carefully. Let me give it a second try:
Answer (the answer is not the probability or probability mass function for
the occurrences of the given pattern, but the expected number of occurrence
of the corresponding pattern--we can use that to tell which pattern is more
likely to happen than others):
(1) 993*4*2*2*4*2*2*2*4/(6^8)
(2) 994*2*2*4*2*2*2*4/(6^7)
(3) 995*4*2*2*4*4*4*2/(6^7)
Reasoning:
-Let's solve (1).
-Define an indicator random variable I1, so that I1=1 ... 阅读全帖
w****a
发帖数: 710
18
bool one_dist(Iterator&& i0, Iterator&& i1) {
int dist = 0;
while(i0.has_next() || i1.has_next()) {
bool h0 = i0.has_next(), h1 = i1.has_next();
int v0 = h0 ? i0.get_next() : 0, v1 = h1 ? i1.get_next() : 0;
if(h0 && h1) {
if(v0 == v1) continue;
else {
h0 = i0.has_next(), h1 = i1.has_next();
if(!h0 && !h1) return dist == 0;
int next0 = h0 ? i0.get_next() : 0, next1 = h1 ? i1.get_next
() : 0;
... 阅读全帖
s****0
发帖数: 956
19
试了一下,把10到20之间的数都找一遍:
Sub look_up_18()
Sheet1.Select
Range("A1").Select
mmm = 0
For NN = 9 To 20
NNN = 0
For I1 = 1 To NN
For I2 = I1 + 1 To NN
For I3 = I2 + 1 To NN
For I4 = I3 + 1 To NN

Sum = I1 + I2 + I3 + I4
prod = (I1 - I2) * (I1 - I3) * (I1 - I4) * (I2 - I3) * (I2 - I4) *
(I3 - I4)

If (Sum = NN) And (prod <> 0) Then
mmm = mmm + 1
NNN = NNN + 1
ActiveCell.Offset(mmm, 3) = NNN
ActiveCell.... 阅读全帖
d*******d
发帖数: 2050
20
来自主题: JobHunting版 - 问道google面试题
didn't see the code you guys posted, maybe you guys already covered my
method.
bool compare_string(const string & str1, const string & str2){
int length1 = str1.length();
int length2 = str2.length();
int max = length1 > length2 ? length1 : length2;
int i1 = 0, i2 = 0;
int i=0;
while(i if( str1[i1] > str2[i2] )
return true;
else if( str1[i1] < str2[i2])
return false;
else{
i1++;
if( i1>=length1){
i1 = i1 - length1;
}
i2++;
... 阅读全帖
y********9
发帖数: 130
21
来自主题: JobHunting版 - 请教一段小程序
main(){
double *res;
double i1, i2, i3;
i1=2.0;
res=&i1;
res++;
i1 = 3.0;
res= &i1;
res++;
i1 = 4.0;
res = &i1;
res = res-2;
printf("%f\n", *res);
}
这个为什么是0呢
s******k
发帖数: 3716
22
来自主题: JobHunting版 - G 家面经
bless。
道所谓的难题这么做(DP):
首先,假设每个节点的金子都是非负数。那么,两个人走的路线必然不相交,否则可以
修改一个人的路线使得总金子数不减少。
现在,两个人同时走,那么在第一步只有一个选择(一个向上一个向右),第二步要在
三个位置取两个,第三步是四个位置取两个。只要知道在该位置的最大钱数就可以继续
计算:
cost(i1,j1,i2,j2) = max(cost(i1,j1-1,i2,j2-1),cost(i1-1,j1,i2,j2-1),cost(i1,
j1-1,i2-1,j2),cos(i1-1,j1,i2-1,j2))+money(i1,j1)+money(i2,j2).
这里i1+j1=i2+j2。最后把cost(m,n,m,n)算出来就好了。

的。
s******k
发帖数: 3716
23
来自主题: JobHunting版 - G 家面经
bless。
道所谓的难题这么做(DP):
首先,假设每个节点的金子都是非负数。那么,两个人走的路线必然不相交,否则可以
修改一个人的路线使得总金子数不减少。
现在,两个人同时走,那么在第一步只有一个选择(一个向上一个向右),第二步要在
三个位置取两个,第三步是四个位置取两个。只要知道在该位置的最大钱数就可以继续
计算:
cost(i1,j1,i2,j2) = max(cost(i1,j1-1,i2,j2-1),cost(i1-1,j1,i2,j2-1),cost(i1,
j1-1,i2-1,j2),cos(i1-1,j1,i2-1,j2))+money(i1,j1)+money(i2,j2).
这里i1+j1=i2+j2。最后把cost(m,n,m,n)算出来就好了。

的。
z*********n
发帖数: 1451
24

也放松一下,贴个以前写的编译时间计算int to Roman number的C++ metaprogramming
, 学生时在实验室天天就玩这种东西了:
class R2I {
const static int DIG;
public:
constexpr static char IN[] = "MCDXLVI"; ///This is the INPUT number;
const static int OUT;
};
template struct ID {};
template <> struct ID <'I'> { static const int I = 0; static const int V = 1
; };
template <> struct ID <'V'> { static const int I = 1; static const int V = 5
; };
template <> struct ID <'X'> { static const int I = 2; static const int V =
10... 阅读全帖
s****0
发帖数: 956
25
这个是一个Excel VB code,可以在Excel里面把表列出来,360组。
Sub look_up_18()
Sheet1.Select
Range("A1").Select
mmm = 0
NN = 18
For I1 = 1 To NN
For I2 = 1 To NN
For I3 = 1 To NN
For I4 = 1 To NN

Sum = I1 + I2 + I3 + I4
prod = (I1 - I2) * (I1 - I3) * (I1 - I4) * (I2 - I3) * (I2 - I4) *
(I3 - I4)

If (Sum = NN) And (prod <> 0) Then
mmm = mmm + 1
ActiveCell.Offset(mmm, 1) = mmm
ActiveCell.Offset(mmm, 2) = I1
Active... 阅读全帖
n****4
发帖数: 12553
k*******a
发帖数: 772
27
来自主题: Statistics版 - 脑筋急转弯的面试题
嗯, code 只是考虑比较简单的情形,不过大概意思差不多
sp <- 15
nbet <- 10000
aa <- function(x) {
win <- rbinom(nbet, 1, .495)
win <- ifelse(win, 1, -1)
winm <- 5 + cumsum(win)*.75
i0 <- which(winm<=0)[1]
i1 <- which(winm>=sp)[1]
i0 <- ifelse(is.na(i0), Inf, i0)
i1 <- ifelse(is.na(i1), Inf, i1)
if (i0==Inf & i1==Inf) return(NA) else return(ifelse(i0 }
b <- sapply(1:5000, aa)
mean(b)
t*******a
发帖数: 4055
28
晨曦:东风41携带10枚核弹头射程一万四空中多次变轨
2017-10-29 17:08栏目:汉唐归来
浏览数:9137次
中国从拥有核武器的第一天起,就向全世界郑重承诺不首先使用核武器。因此,要想维
持有效的核威慑能力,中国必须在加强核武器的生存能力和反击能力方面狠下功夫,这
样才能确保对手不敢对中国发动先发制人的核打击。由于中国自身的地理条件存在三个
重要的限制因素:第一,中国本土与主要假想敌本土之间的距离非常遥远,最短的直线
距离也超过8000公里;第二,中国通往远洋的所有出海口均处于主要假想敌的封锁之下
;第三,中国没有安全可靠的友国和海外地区可供核打击力量实施前出部署、抵近威慑。
http://i1.go2yd.com/image.php?url=0HZTPslIwU
陆基核反击力量是我国最可靠的战略核威慑支柱
因此对于中国而言,在传统的“三位一体”核打击平台当中,空基和海基的核打击平台
只能充当辅助性力量,效率最高、可靠性最好的非陆基核打击平台莫属。上个世纪80年
代初,中国成功试射了陆基洲际导弹,逐步开始建立可以有效覆盖主要假想敌的陆基核
打击力量。进入21世纪以后,我国的... 阅读全帖
a*******6
发帖数: 520
29
Suppose the array is A[1]... A[n], and each A[i] \in {1, ..., n-1}
Corrected method:
1. Start from A[n] instead of A[1]
2. Once I1 == I2, use another O(N) time to find the length of the cycle
3. Then start from A[n] again: set I1 = n and I2 = A[A[A[A[I1]]]] (if the
cycle's length is 4); repeat I1 = A[I1] and I2 = A[I2] until I1 == I2

the
the
This
c**s
发帖数: 23
30
public boolean isInterleave(char[] s1, int i1, char[] s2, int i2, char[] s3,
int i3) {
if (i3 == s3.length) {
if (i1 == s1.length && i2 == s2.length) return true;
return false;
}
if (i1 < s1.length && s1[i1] == s3[i3] && this.isInterleave(s1, i1 + 1, s2
, i2, s3, i3 + 1))
return true;
if (i2 < s2.length && s2[i2] == s3[i3] && this.isInterleave(s2, i2 + 1, s1
, i1, s3, i3 + 1))
return true;
return false;
}
public boolean isInterleave(String s1, String s2, String s3) {
... 阅读全帖
x***y
发帖数: 633
31
来自主题: JobHunting版 - G 家面经
Just write to mark for personal reference purpose
>>>>>>>>>>
一个 m x n 二维区域,每个点上有一定数量的钱,考虑路径 : 从坐下角
(m-1, 0)出发,终点是 右上角(0, n-1), 在每个点只能向右或者向上走,
现在有两个人,从起点出发,走到终点,问怎么样求出这两个人能拿到
的钱的和的最大值
>>>>>>>>>>
(1) Find one single optimal path P which contains m+n point
(2) For each point (i,j), (k,h) in P, denoting P((i,j)->(k,h)) as the path
connecting 2 points in P, there is one property
* For all the possible paths between (i,j) and (k,h), the P((i,j)->(k,h)) is
op... 阅读全帖
x***y
发帖数: 633
32
来自主题: JobHunting版 - G 家面经
Just write to mark for personal reference purpose
>>>>>>>>>>
一个 m x n 二维区域,每个点上有一定数量的钱,考虑路径 : 从坐下角
(m-1, 0)出发,终点是 右上角(0, n-1), 在每个点只能向右或者向上走,
现在有两个人,从起点出发,走到终点,问怎么样求出这两个人能拿到
的钱的和的最大值
>>>>>>>>>>
(1) Find one single optimal path P which contains m+n point
(2) For each point (i,j), (k,h) in P, denoting P((i,j)->(k,h)) as the path
connecting 2 points in P, there is one property
* For all the possible paths between (i,j) and (k,h), the P((i,j)->(k,h)) is
op... 阅读全帖
Q*****a
发帖数: 33
33
来自主题: JobHunting版 - 这个Google题有什么好的解法吗?
几个优化方案:
对输入价格列表按物品个数排序,长的输入先计算能否用短的输入以更低成本表示,若
是则将其从价格列表中删除,这样可以减少价格列表数目,优化搜索
匹配时对价格列表按长到短搜索,到长度为1列表时直接计算,不用搜索了
备忘录记录中间搜索结果(内存会否爆棚)
简单贪心法行不通(也许有更好的贪心法本人没想到)
(i2,I4,I6,i8,i10): 5
(i1, i2):2
(i3, i4):2
(i5, i6):2
(i7, i8):2
(i9, i10):2
i1…i10:2
对于此价格列表,(i1,i2,i3,i4,i6,,i8,i10)最优解为[(i2,i4,i6,i8,i10), (i1), (
i3)]=9,而(i1,i2,i3,i4,i5,i6,i8,i10)最优解为[(i1,i2),(i3,i4),(i5,i6),i8,i10]=
10
i****a
发帖数: 36252
c*****o
发帖数: 178
35
来自主题: JobHunting版 - random(5) generate random(7)
如下方法:
int Random7()
{ int i1,i2,i3;
i1=Random(5)%2;
i2=Random(5)%2;
i3=Random(5)%2;
return (i1*4+i2*2+i1);
}
i1,i2,i3 = 0 的概率是2/5,=1的概率是3/5。这样产生的random(7)是真的random
吗?
l*********y
发帖数: 142
36
来自主题: JobHunting版 - Palantir面经2
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
struct Segment {
int from, to;
};
struct cmp {
bool operator() (const Segment& s1, const Segment& s2) {
return s1.from < s2.from;
}
};
bool ... 阅读全帖
t****a
发帖数: 1212
37
来自主题: JobHunting版 - Wildcard Matching题求助
这题怎么用greedy来做呢?DP的话是n*m计算量
memoize dp的解
(defn is-match [str1 str2]
(let [str1a (str str1 \a)
str2a (str str2 \a)
n1 (count str1a)
n2 (count str2a)
seq2 (apply concat (repeat n1 (range n2 -1 -1)))
seq1 (mapcat #(repeat n2 %) (range n1 -1 -1))
]
(do
(def is-match-rec
(memoize
(fn [i1 i2]
(let [l1 (- n1 i1)
l2 (- n2 i2)]
(cond (and (== 0 l1) (== 0 l2)) true
(or (=... 阅读全帖
c**i
发帖数: 8
z**********e
发帖数: 22064
39
来源:沪江部落
编辑点评:不知道是因为日语学得走火入魔了,还是真的有惊人相似,有时候听到某种
中国方言会惊觉:怎么那么像日语?或者听到某句日语的时候一口水喷出:这不是我家
乡话吗?!
不知道是因为日语学得走火入魔了,还是真的有惊人相似,有时候听到某种中国方言会
惊觉:怎么那么像日语?或者听到某句日语的时候一口水喷出:这不是我家乡话吗?!
嘛,日语与汉语有着很大的渊源,有相像的地方也很正常。
有说上海话像日语,有说宁波话像日语,有说湖州话像日语,有说福建话像日语……每
个人的耳朵听到的语言与日语的对照有不同的相似度。这里虎虎来说一位日语系同学的
“遭遇”。据说刚来上海念大学的时候,同寝室住着几个上海同学,相互聊天的时候噼
里啪啦讲上海话,怎么听怎么像日语,这位同学瞬间石化:“还没学就已经把日语说得
那么流利了……”鸭梨不是一点点,后来得知真相后也还是要叹一个:上海话跟日语好
像啊……
以下是由沪友们评选出的与日语最像的中国方言TOP5
TOP1:上海话
猜猜上海话:
http://i1.w.hjfile.cn/doc/201101/shanghaihua16.mp3
(由沪友yuna83... 阅读全帖
r****o
发帖数: 1950
40
来自主题: Programming版 - C++怎么写任意重重循环?
像下面这样的多层循环是不是也有一个hidden loop在里面,比如说当i1=1,i2=i3=i4=9
, i4再增加的时候,它要先比较i3,i2,而不是直接跳到i1。对吧?
for (i1=0;i1<10;i1++)
for (i2=0;i2<10;i2++)
for (i3=0;i3<10;i3++)
for (i4=0;i4<10;i4++)
{
}
p********a
发帖数: 5352
41
来自主题: Statistics版 - [SAS] row merging
data a;
input A I L R;
datalines;
a 0 1 2
a 0 3 4
a 1 5 6
a 1 2 3
a 0 4 5
a 0 5 9
run;
data b(drop=I1 L1 R1);
set a;
retain I1 L1 R1;
if _N_=1 then do; I1=I;L1=L;R1=R;end;
else do; if I=I1 then do;L=L1;output;end;
else do;I1=I;L1=L;R1=R;end;
end;
run;
l*****r
发帖数: 990
42
首先,Gurson model 不能很好模拟剪切模式,加不加nucleation都一样,这是老夫20
年前就有的理解,并不是从你那里学来的。
用 I1–J2–J3 来描述压力相关的金属剪切带很早就有,你并不是第一个。我觉得这个
insight真的很一般,我大约20年前就知道。举几个比你早10年金属剪切带的例子:
Lee YK and Gosh J. (1999). THE SIGNIFICANCE OF J3 TO THE PREDICTION OF SHEAR
BANDS, International Journal of Plasticity, Vol. 12, No. 9, pp. 1179-1197.
Brunig (1999, 2001) and Brunig et al. (2000) have studied numerically the
effect of hydrostatic stress sensitivity on shear-band development in iron-
based high-strength metals, using general... 阅读全帖
l******e
发帖数: 6
43
来自主题: JobHunting版 - 做道有序数组元素求最大和题?
int a1[] = {5,2,1};
int a2[] = {3,2,1};
用4个指针指向两个数组(头和尾分别是(5,2)和(3,2)),同时扫描连个数组并
比较大小,每
次只挪动一个尾指针;直到一个数组结束,再修改头指针。
void output(int* a1, int* a2, int* b, int n)
{
int count = 1;
b[0] = a1[0]+a2[0];
int i1(0), i2(0), j1(1), j2(1);
while (count < n)
{
if (a1[i1]+a2[j2] > a2[i2]+a1[j1])
{
b[count] = a1[i1]+a2[j2];
j2++;
if (j2 == n)
{
j2 = 1;
i1++;
}
}
else
j*****u
发帖数: 1133
44
来自主题: JobHunting版 - Microsoft screening programming problem
bool F(string s, char ch1, char ch2, int n)
{
if (string.IsNullOrEmpty(s) || n <= 0 || ch1 == ch2)
throw new ArgumentException();
var index1 = new List();
var index2 = new List();
for (int i = 0; i < s.Length; i++)
{
if (s[i] == ch1)
index1.Add(i);
else if (s[i] == ch2)
index2.Add(i);
}
int minDist = int.MaxValue;
int i1 = 0, i2 = 0;
while (i1 < index1.Count && i2 < index2.Count)
{
int diff ... 阅读全帖
j*****u
发帖数: 1133
45
来自主题: JobHunting版 - Microsoft screening programming problem
bool F(string s, char ch1, char ch2, int n)
{
if (string.IsNullOrEmpty(s) || n <= 0 || ch1 == ch2)
throw new ArgumentException();
var index1 = new List();
var index2 = new List();
for (int i = 0; i < s.Length; i++)
{
if (s[i] == ch1)
index1.Add(i);
else if (s[i] == ch2)
index2.Add(i);
}
int minDist = int.MaxValue;
int i1 = 0, i2 = 0;
while (i1 < index1.Count && i2 < index2.Count)
{
int diff ... 阅读全帖
s**x
发帖数: 405
46
This is exactly equivalent to finding loop in a singly linked list.
The singly linked list is defined with entry A[0] of the input array as the
HEAD node, and the numeric value of each array element as the array index
for the NEXT node. Since every array element A[i] is between 1..(n-1), all
the nodes have valid NEXT node pointers. Thus by sequentially traversing the
list you will encounter a loop.
Just use two iterators I1 and I2, initialized to A[0] and A[A[0]]. Then
while (I1 != I2), let I1 =... 阅读全帖
s********e
发帖数: 340
47
来自主题: JobHunting版 - 急问一个Java Hashset的 考试题。
3. import java.util.*;
4. public class Mapit {
5. public static void main(String[] args) {
6. Set set = new HashSet();
7. Integer i1 = 45;
8. Integer i2 = 46;
9. set.add(i1);
10. set.add(i1);
11. set.add(i2); System.out.print(set.size() + " ");
12. set.remove(i1); System.out.print(set.size() + " ");
13. i2 = 47;
14. set.remove(i2); System.out.print(set.size() + " ");
15. }
16. }
What is the result?
输出结果是 211
我不理解为什么是211呢?在第14行,set.remove(i2); 这个已经将i2从set中移除了,
我觉得 set这时应该是有0个元素,... 阅读全帖
c**********e
发帖数: 2007
48
来自主题: JobHunting版 - 看一道string permutation的题目吧
This looks nasty, but it should work.
char* s=string.c_str();
for(int i1=0;i1<3;i1++) {
for(int i2=0;i2<3;i2++) {
for(int i3=0;i3<3;i3++) {
for(int i4=0;i4<3;i4++) {
for(int i5=0;i5<3;i5++) {
for(int i6=0;i6<3;i6++) {
cout << s[i1] << s[i2] << s[i3] << s[i4] << s[i5] << s[i6] << endl;
}
}
}
}
}
}
l***i
发帖数: 1309
49
来自主题: JobHunting版 - 4sum的那道题
Seems you can do O(n^2 log n)
For each pair of numbers, you can get a total of n^2 two-number sums.
Sort them cost O(n^2 log n)
Then you can use your target value T - each sum to get n^2 values sorted.
Then your job is to find whether there are two numbers that sum to any of
those n^2 values. This can be done by merge two sorted lists:
list1: a[i]+a[j] for each 1<=i,j<=n
list2: T-(a[i]+a[j]) for each 1<=i,j<=n
if list1 and list2 have a match, then a[i1]+a[j1] = T-(a[i2]+a[j2]) and that
is the sa... 阅读全帖
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)