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

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

🔗
liuzhe1218 2013-2-21 11:08:42 | 只看该作者
全局:
C language
https://gist.github.com/mettaworld/5001491
calculate the length of string. Then swap the ith char from beginning with the ith char from the end in a loop.
回复

使用道具 举报

🔗
rialmat 2013-2-21 12:13:46 | 只看该作者
全局:
C++, use strlen and swap, the code is self-explanatory.
https://gist.github.com/rischimart/5001944#file-cc1_2-cpp
回复

使用道具 举报

🔗
jwzxgo 2013-2-21 19:59:45 | 只看该作者
全局:
Kimurate 发表于 2013-2-18 20:12
我的看法:
题目要求 reverse 函数返回值为 void;
指向数组尾的指针可以用 strlen 获得;

收到!多谢!
回复

使用道具 举报

🔗
willians512 2013-2-22 10:57:58 | 只看该作者
全局:
https://gist.github.com/bigteeth/5010397

我实现的时候出了一点小问题,发现是个低级错误,这里提醒大家。 如果我定义字符串的方式为 char* s="reverseString" 会出现什么问题呢
回复

使用道具 举报

🔗
ThunderXu 2013-2-23 09:39:58 | 只看该作者
全局:
https://gist.github.com/ThunderXu/5017888
定义一个头指针一个尾指针并在他们靠拢的同时交换所指向的元素。
楼上的问题我也遇到了,查了网站才知道这时char* s是一个指向字符串常量的指针,看来还要好好补一下基础了
回复

使用道具 举报

🔗
qiaobao 2013-2-25 04:43:16 | 只看该作者
全局:
Determine the length of the string;
left = the first character;
right = the last character;
while ( left < right) {
  swap ;
}

https://gist.github.com/Andy1989/212f8811b08eaf0eda86
回复

使用道具 举报

🔗
sjtuzyt 2013-2-25 18:08:33 | 只看该作者
回复

使用道具 举报

🔗
cjsp 2013-2-28 20:07:49 | 只看该作者
回复

使用道具 举报

🔗
season 2013-3-2 14:05:44 | 只看该作者
全局:
this is my answer...
https://gist.github.com/ShaneLittleton/5069892
回复

使用道具 举报

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

本版积分规则

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