想学CS的,俺出道题,如果做出来了,可以直接到Google或者Apple 去面试

来源: 王伍 2018-03-13 21:00:17 [] [旧帖] [给我悄悄话] 本文已被阅读: 次 (478 bytes)

哈哈

设计一个程序,在一个字符串里找出没有重复字母的最长子字符串。要求程序的运行速度是 O(n).

举个例子: 字符串”ABCABC“ 的没有重复字母的最长子字符串是”ABC“。

 

 

所有跟帖: 

Here -yellowlemon- 给 yellowlemon 发送悄悄话 yellowlemon 的博客首页 (87 bytes) () 03/13/2018 postreply 21:07:23

赞一个 -王伍- 给 王伍 发送悄悄话 (190 bytes) () 03/13/2018 postreply 21:15:02

哈哈哈哈。 -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (0 bytes) () 03/13/2018 postreply 21:16:54

我刚辅导完孩子数学,上来一看, -yellowlemon- 给 yellowlemon 发送悄悄话 yellowlemon 的博客首页 (238 bytes) () 03/13/2018 postreply 21:18:52

算法无非就是字符串,爬树,等等 -王伍- 给 王伍 发送悄悄话 (0 bytes) () 03/13/2018 postreply 21:22:55

算法很复杂好不好? -yellowlemon- 给 yellowlemon 发送悄悄话 yellowlemon 的博客首页 (0 bytes) () 03/13/2018 postreply 21:25:56

就是数学,其实已经和计算机没啥关系了 -王伍- 给 王伍 发送悄悄话 (0 bytes) () 03/13/2018 postreply 21:29:06

所以我说要想工资高进大公司,首先得数学好,我家 -yellowlemon- 给 yellowlemon 发送悄悄话 yellowlemon 的博客首页 (197 bytes) () 03/13/2018 postreply 21:33:22

去啊,去了告诉他,数学学到三角函数,哈哈哈 -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (0 bytes) () 03/13/2018 postreply 21:34:36

去了一听说不是专业学数学的,人家就没兴趣了, -yellowlemon- 给 yellowlemon 发送悄悄话 yellowlemon 的博客首页 (63 bytes) () 03/13/2018 postreply 21:37:30

唉我当年要是专业用数学就好了,这把年龄了,早上学会下午就忘了 -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (0 bytes) () 03/13/2018 postreply 21:39:11

别说,我看懂了:))) -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (0 bytes) () 03/13/2018 postreply 21:16:38

哪俺考考你,这是啥语言? -王伍- 给 王伍 发送悄悄话 (0 bytes) () 03/13/2018 postreply 21:18:30

用的是Java啊,我们学了while loop, if, else if, else -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (0 bytes) () 03/13/2018 postreply 21:19:27

j++ 就是每次加1,()里有条件,hehe,我上了一节课的啊 -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (0 bytes) () 03/13/2018 postreply 21:20:57

哈哈,还行,你能学好 -王伍- 给 王伍 发送悄悄话 (0 bytes) () 03/13/2018 postreply 21:21:15

啊,这就算过关了?得到批准学习了?:))) -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (0 bytes) () 03/13/2018 postreply 21:22:25

你学这种计算机的语言应该没问题 -王伍- 给 王伍 发送悄悄话 (153 bytes) () 03/13/2018 postreply 21:25:29

那我的思维咋样?打分一下,几个白眼? -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (169 bytes) () 03/13/2018 postreply 21:26:30

你先说说,如果不看代码,对这个问题你准备怎么下手? -王伍- 给 王伍 发送悄悄话 (0 bytes) () 03/13/2018 postreply 21:28:17

唉,看了方法就入脑了,再说自己本来就是这样想的,总有说谎的成份。要不你问个别的吧 -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (0 bytes) () 03/13/2018 postreply 21:30:01

没学过算法的人,肯定 -yellowlemon- 给 yellowlemon 发送悄悄话 yellowlemon 的博客首页 (21 bytes) () 03/13/2018 postreply 21:27:47

对,应该鼓励她,这里最重要的算法, -yellowlemon- 给 yellowlemon 发送悄悄话 yellowlemon 的博客首页 (32 bytes) () 03/13/2018 postreply 21:22:38

就看到我上面说的那些了,当然知道这是用String,差不多就这样了:)))别期待太多 -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (0 bytes) () 03/13/2018 postreply 21:24:01

能看懂?那你毕业了 -外乡人- 给 外乡人 发送悄悄话 外乡人 的博客首页 (0 bytes) () 03/13/2018 postreply 21:19:10

看懂思路 -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (0 bytes) () 03/13/2018 postreply 21:55:07

这个在数据结构的算法里是不难的。 -Sarahzhou- 给 Sarahzhou 发送悄悄话 (0 bytes) () 03/13/2018 postreply 21:28:37

算法本身不难,难的是对速度的要求,大部分码工写出来的是O(n**3) -王伍- 给 王伍 发送悄悄话 (0 bytes) () 03/13/2018 postreply 21:30:09

唉,你知道我一个作业要求测一个用户随便打出来的东西的length 我用了多少时间吗? -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (190 bytes) () 03/13/2018 postreply 21:33:42

为什么呀,Java多好用呀,string.length,直接就给出来呀。 -yellowlemon- 给 yellowlemon 发送悄悄话 yellowlemon 的博客首页 (0 bytes) () 03/13/2018 postreply 21:35:45

不是还要提示用户输入嘛。输入的里面有什么又要提示错误,再提示输入,那教授啰嗦得很 -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (0 bytes) () 03/13/2018 postreply 21:38:30

你就拿上面的这题考你教授,保证把他给考趴下 -王伍- 给 王伍 发送悄悄话 (169 bytes) () 03/13/2018 postreply 21:39:53

教算法的教授估计能过 -yellowlemon- 给 yellowlemon 发送悄悄话 yellowlemon 的博客首页 (0 bytes) () 03/13/2018 postreply 21:41:59

那当然,教算法自然就会想到 -王伍- 给 王伍 发送悄悄话 (0 bytes) () 03/13/2018 postreply 21:43:34

把他考趴下就给我一个D :)))) -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (0 bytes) () 03/13/2018 postreply 21:44:47

你还可以啦,最起码不是 -yellowlemon- 给 yellowlemon 发送悄悄话 yellowlemon 的博客首页 (25 bytes) () 03/13/2018 postreply 21:40:03

哈哈哈。唉你不知道,我很要强的,学那节课真的把我整到了,你看我从来不上来文作业。 -ahya- 给 ahya 发送悄悄话 ahya 的博客首页 (69 bytes) () 03/13/2018 postreply 21:44:06

想不到文學城的大媽都勝過公司的阿三。 -ILHP- 给 ILHP 发送悄悄话 (0 bytes) () 03/13/2018 postreply 23:16:30

做一个2叉数,在建树的过程中,需要记录扫描的顺序和次数 -mapletiger- 给 mapletiger 发送悄悄话 mapletiger 的博客首页 (324 bytes) () 03/14/2018 postreply 06:25:00

请您先登陆,再发跟帖!