由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - Reverse characters of each word in a sentence
相关主题
"简单的"linklist的问题reverse bits problem
如何 reversely print一个single linked-list中各个node里的数据?实现next_permutation
reverse an array讨论个iterator, reverse_iterator, const iterator and const reverse_iterator 之间转换
悲剧的FB二面两种DP
一个Linkedlist面试题的教训弱问一下,C++写算法代码的时候尽量用STL么?
问了一个链表,1->2->3->4->5, 每两个交换,2->1->4->3->5,reverse words 中包含标点符号 “, 。 ! ?”怎么做
弱问题,连反转链表都看不懂了我发现我竟然学会了12种tree traversal的办法
const_reverse_iterator和reverse_iterator有什么区别?Algorithm for Reversal
相关话题的讨论汇总
话题: each话题: reverse话题: character话题: clever话题: word
进入JobHunting版参与讨论
1 (共1页)
r*******k
发帖数: 1423
1
Read more: http://www.businessinsider.com/8-mind-bending-interview-questions-that-google-asks-its-engineers-2012-7?op=1#ixzz3BAjAab00
ANSWER: There's a more clever way to do it than just flipping each character.
ANSWER: There's a more clever way to do it than just flipping each character.
Boonsri Dickinson, Business Insider
You can solve the problem iteratively — by basically plowing through each
character and moving it — but there's a clever way to solve it using
something called recursion.
This is basically what Google typically wants: Engineers who find the
smartest solution, not just a correct solution.
That breaks the problem into smaller problems of reversing each word and
then recombining them into a statement.
Read more: http://www.businessinsider.com/8-mind-bending-interview-questions-that-google-asks-its-engineers-2012-7?op=1#ixzz3BAjfvUEi
r*******k
发帖数: 1423
2
实在是没懂,为什么不能一个单词一个单词的reverse
不也是o(N)么?
搞成recursion的,就是好看点吧。。。

character.
character.

【在 r*******k 的大作中提到】
: Read more: http://www.businessinsider.com/8-mind-bending-interview-questions-that-google-asks-its-engineers-2012-7?op=1#ixzz3BAjAab00
: ANSWER: There's a more clever way to do it than just flipping each character.
: ANSWER: There's a more clever way to do it than just flipping each character.
: Boonsri Dickinson, Business Insider
: You can solve the problem iteratively — by basically plowing through each
: character and moving it — but there's a clever way to solve it using
: something called recursion.
: This is basically what Google typically wants: Engineers who find the
: smartest solution, not just a correct solution.
: That breaks the problem into smaller problems of reversing each word and

s***5
发帖数: 2136
3
stupid engineers think recursion is free.
r*******k
发帖数: 1423
4
应该不至于
看了看解答,好像是链表的形式
不管了

【在 s***5 的大作中提到】
: stupid engineers think recursion is free.
1 (共1页)
进入JobHunting版参与讨论
相关主题
Algorithm for Reversal一个Linkedlist面试题的教训
请问如何安全地reverse 一个integer问了一个链表,1->2->3->4->5, 每两个交换,2->1->4->3->5,
BB的面试题-只用&和| 如何reverse a bit string?弱问题,连反转链表都看不懂了
L 电面2const_reverse_iterator和reverse_iterator有什么区别?
"简单的"linklist的问题reverse bits problem
如何 reversely print一个single linked-list中各个node里的数据?实现next_permutation
reverse an array讨论个iterator, reverse_iterator, const iterator and const reverse_iterator 之间转换
悲剧的FB二面两种DP
相关话题的讨论汇总
话题: each话题: reverse话题: character话题: clever话题: word