Redian新闻
>
Re: 工作后第二张工资单,感觉还是很穷啊,大家说说自己的情况 (转载)
avatar
Re: 工作后第二张工资单,感觉还是很穷啊,大家说说自己的情况 (转载)# Joke - 肚皮舞运动
w*x
1
直接贴Google doc了
Given a word, print out all the combinations of words from the letters that
make it. For example:
bad: abd adb bda dab dba
void _inner_print(char str[], int len, int pos)
{
if (pos == len)
{
cout<return;
}
for (int i = pos; i < len; i++)
{
swap(str[pos], str[i]);
_inner_print(str, len, pos+1);
swap(str[pos], str[i]);
}
}
Input: bad
step 1: 3, i = 0 - bad
step 2.: 3, i = 1 - abd
step 2.: 3, i = 2 - dabchar
void printAllPermutation(const char* str)
{
if (NULL == str || 0 == *str)
return;
int nLen = strlen(str);
char* strTmp = new char[nLen+1];
strcpy(strTmp, str);
_inner_print(strTmp, nLen, 0);
delete [] strTMp;
}
Serialize a list of strings to a file
Input is a file, an array of string pointers and number of elements in the
array. Serialize all the strings in the given file.
bool serializeStrList(const char* strs[], int n, const char* szFileName)
{
if (NULL == strs || n <= 0 || NULL == szFile)
return false;

FILE* pf = fopen(szFileName, ‘r’);
if (NULL == pf)
return false;
for (int i = 0; i < n; i++)
{
int nWrite = strlen(strs[i]) + 1;
int nWriten = 0;

while (nWriten < nWrite)
nWriten += fwrite(strs[i], nWrite, sizeof(char), pf);
}
fclose(pf);
return true;
}
fwrite()
avatar
l*i
2
保修iphone home键坏了,需要去修。结果全款退给我了。
★ 发自iPhone App: ChineseWeb 8.7
avatar
d*f
3
【 以下文字转载自 JobHunting 讨论区 】
发信人: Geman (Delta30), 信区: JobHunting
标 题: Re: 工作后第二张工资单,感觉还是很穷啊,大家说说自己的情况
发信站: BBS 未名空间站 (Sat Oct 13 14:53:50 2012, 美东)
算得不准确,401K有的税前的,有部分是Roth税后的,我放到上限17K。HSA好像算错了
应该是30多。但基本这样,到
手16××。不是27个pay period吗,怎么是26呢?一年54个星期啊。
中部房价在同一个城市也要看地方,我这离公司近的最便宜的1b也要1000左右,但住的
有点偏,堵车。离超市近点的不堵车的就这个房价了。
avatar
j*y
4
thanks。 你的第一题的code感觉有点问题, swap 以后,应该 swap 回来
for (int i = pos; i < len; i++)
{
swap(str[pos], str[i]);
_inner_print(str, len, pos+1);
swap(str[pos], str[i]);
swap(str[pos], str[i]);
}

Given a word, print out all the combinations of words from the letters that
make it. For example:
bad: abd adb bda dab dba
void _inner_print(char str[], int len, int pos)
{
if (pos == len)
{
cout<return;
}
for (int i = pos; i < len; i++)
{
swap(str[pos], str[i]);
_inner_print(str, len, pos+1);
swap(str[pos], str[i]);
}
}
Input: bad
step 1: 3, i = 0 - bad
step 2.: 3, i = 1 - abd
step 2.: 3, i = 2 - dabchar
void printAllPermutation(const char* str)
{
if (NULL == str || 0 == *str)
return;
int nLen = strlen(str);
char* strTmp = new char[nLen+1];
strcpy(strTmp, str);
_inner_print(strTmp, nLen, 0);
delete [] strTMp;
}

【在 w****x 的大作中提到】
: 直接贴Google doc了
: Given a word, print out all the combinations of words from the letters that
: make it. For example:
: bad: abd adb bda dab dba
: void _inner_print(char str[], int len, int pos)
: {
: if (pos == len)
: {
: cout<: return;

avatar
a*g
5
好啊。

【在 l*******i 的大作中提到】
: 保修iphone home键坏了,需要去修。结果全款退给我了。
: ★ 发自iPhone App: ChineseWeb 8.7

avatar
w*x
6

that
有swap回来

【在 j*****y 的大作中提到】
: thanks。 你的第一题的code感觉有点问题, swap 以后,应该 swap 回来
: for (int i = pos; i < len; i++)
: {
: swap(str[pos], str[i]);
: _inner_print(str, len, pos+1);
: swap(str[pos], str[i]);
: swap(str[pos], str[i]);
: }
:
: Given a word, print out all the combinations of words from the letters that

avatar
t*r
7
iphone是全价买的还是contract啊?

【在 l*******i 的大作中提到】
: 保修iphone home键坏了,需要去修。结果全款退给我了。
: ★ 发自iPhone App: ChineseWeb 8.7

avatar
j*y
8
没看到,呵呵. sorry :)

【在 w****x 的大作中提到】
:
: that
: 有swap回来

avatar
l*i
9
contract 退了200多

★ 发自iPhone App: ChineseWeb 8.7

【在 t*********r 的大作中提到】
: iphone是全价买的还是contract啊?
avatar
j*y
10
第二题 deserialize的话就是通过 '\0'来分开,是吧.

that

【在 w****x 的大作中提到】
: 直接贴Google doc了
: Given a word, print out all the combinations of words from the letters that
: make it. For example:
: bad: abd adb bda dab dba
: void _inner_print(char str[], int len, int pos)
: {
: if (pos == len)
: {
: cout<: return;

avatar
m*r
11
pai

【在 l*******i 的大作中提到】
: 保修iphone home键坏了,需要去修。结果全款退给我了。
: ★ 发自iPhone App: ChineseWeb 8.7

avatar
j*y
12
第二题我习惯用 fstream
ofstream file(inputFile);
for(int i = 0; i < n; ++i)
{
string s(array[i]);
s.append(1, '\0');
file<< s;
}
file.close();

【在 j*****y 的大作中提到】
: 第二题 deserialize的话就是通过 '\0'来分开,是吧.
:
: that

avatar
j*y
13
不过感觉 s.append(1, '\0') 有点问题.

【在 j*****y 的大作中提到】
: 第二题我习惯用 fstream
: ofstream file(inputFile);
: for(int i = 0; i < n; ++i)
: {
: string s(array[i]);
: s.append(1, '\0');
: file<< s;
: }
: file.close();

avatar
p*2
14
第一题combination 还是permutation呢?需要考虑字母重复吗?
avatar
p*2
15
第一题练习
object test2 extends App {
val word="bad"
word.permutations.foreach(println)
}
bad
bda
abd
adb
dba
dab
avatar
j*y
16
这个肯定不能拿来面试吧?呵呵

【在 p*****2 的大作中提到】
: 第一题练习
: object test2 extends App {
: val word="bad"
: word.permutations.foreach(println)
: }
: bad
: bda
: abd
: adb
: dba

avatar
j*y
17
好像也没问题 :)

【在 j*****y 的大作中提到】
: 不过感觉 s.append(1, '\0') 有点问题.
avatar
c*t
18
scala? cheater!

【在 p*****2 的大作中提到】
: 第一题练习
: object test2 extends App {
: val word="bad"
: word.permutations.foreach(println)
: }
: bad
: bda
: abd
: adb
: dba

avatar
p*2
19

scala应该怎么面试?

【在 j*****y 的大作中提到】
: 这个肯定不能拿来面试吧?呵呵
avatar
t*h
20
牛叉 拜伏

【在 p*****2 的大作中提到】
: 第一题练习
: object test2 extends App {
: val word="bad"
: word.permutations.foreach(println)
: }
: bad
: bda
: abd
: adb
: dba

avatar
k*x
21
悟空你又调皮了。。。

【在 p*****2 的大作中提到】
: 第一题练习
: object test2 extends App {
: val word="bad"
: word.permutations.foreach(println)
: }
: bad
: bda
: abd
: adb
: dba

avatar
t*a
22
号召大家像楼主学习啊,头像多赏心悦目

that

【在 w****x 的大作中提到】
: 直接贴Google doc了
: Given a word, print out all the combinations of words from the letters that
: make it. For example:
: bad: abd adb bda dab dba
: void _inner_print(char str[], int len, int pos)
: {
: if (pos == len)
: {
: cout<: return;

avatar
c*a
23
google doc啊...
要自己敲space indentation......
avatar
Q*e
24
现在面试都改scala了?

【在 p*****2 的大作中提到】
: 第一题练习
: object test2 extends App {
: val word="bad"
: word.permutations.foreach(println)
: }
: bad
: bda
: abd
: adb
: dba

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。