楼主: Fanyare
跳转到指定楼层
上一主题 下一主题
收起左侧

[CareerCup] [第二轮] 2/18-2/24 CareerCup 1.3

🔗
lazyGoose 2013-2-20 02:34:02 | 只看该作者
全局:
本帖最后由 lazyGoose 于 2013-2-20 02:37 编辑

先排序呀,再判断
Arrays.sort -->  Arrays.toString
https://gist.github.com/lazyGoose/4988562

另外,哪位能教教我怎么加链接...

点评

我每次发都是自动加上的......  发表于 2013-2-21 04:26
回复

使用道具 举报

🔗
champoier 2013-2-20 02:47:27 | 只看该作者
全局:
先判断是否长度相等,再对两个string排序,最后判断sorted string是否相等

https://gist.github.com/skxie/4b4a5eb6ac2cdef047a2
回复

使用道具 举报

🔗
 楼主| Fanyare 2013-2-20 05:19:39 | 只看该作者
全局:
https://github.com/quantumrose/C ... .3.Permutation.java

method1: quicksort two strings and compare
methdo2: compare character counts
回复

使用道具 举报

🔗
amoscoder 2013-2-20 12:28:38 | 只看该作者
全局:
新手学习
思路:
     1、sort分别排序后,从第一个字符开始依次比较两个string字符是否相等。
     2、使用bitmap储存字符出现次数。两个string的相同字符的数目必须相等。


https://gist.github.com/KuangyinWang/4992851





回复

使用道具 举报

🔗
amoscoder 2013-2-20 12:32:06 | 只看该作者
全局:
lazyGoose 发表于 2013-2-20 02:34
先排序呀,再判断
Arrays.sort -->  Arrays.toString
https://gist.github.com/lazyGoose/4988562

同求,我也没加上。
回复

使用道具 举报

🔗
yukainuo23 2013-2-20 13:25:49 | 只看该作者
全局:
https://gist.github.com/KainuoYU/4993144

这里有两种方法,一种是sort再比较,效率是O(nlgn),另外一种是用数组数不同字符个数,思想应该和hashset一致,效率为O(n)
回复

使用道具 举报

全局:
吐下糟,由于string,stringbuffer,char[]的基本java操作不熟,在这题上浪费了太多的时间。第一次感到C是真方便。。。。


https://github.com/1094401996/Ca ... dot3/RemoveDul.java
回复

使用道具 举报

🔗
liuzhe1218 2013-2-20 20:19:54 | 只看该作者
全局:
Java language
https://gist.github.com/mettaworld/4995136
make a little complex algorithm. It processes string in this way: abcdabcd - a2b2c2d2
Then compare the first string with the second one.
回复

使用道具 举报

🔗
sunnyroom 2013-2-20 21:55:23 | 只看该作者
全局:
Assume they are ascii string
1 sort
2 compare
https://gist.github.com/sunxw/4995674
回复

使用道具 举报

🔗
SunnyDay1022 2013-2-21 12:34:38 | 只看该作者
全局:
compare the length of two strings; if they are equal then create boolean array of size 256, initialized false
go through original string, set corresponding one in the array true when finding each character
go through the second string, check the boolean array when finding each character
https://github.com/swang1022/car ... 3/isPermutation.cpp
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表