Home  >  Article  >  Backend Development  >  google的一道面试题目大家来试下解决办法

google的一道面试题目大家来试下解决办法

WBOY
WBOYOriginal
2016-06-13 13:33:00851browse

google的一道面试题目大家来试下
一道算法题,和搜索建议有关的,我搞了很久没搞出来,有能力的试下,我大致说下题目
数组A={a,b,c,d,e,f}
数组B={u,y,w,x,y,z}
输出字符串规律如下:
a
u
ab
uy
ay
ub
abc
uyw
abw
ayw
ubc
uyc
ayw
ubw
.
.
.
先找规律,再求算法, 算法语言不限





------解决方案--------------------

PHP code
$a = array('a', 'b', 'c', 'd', 'e', 'f');
$b = array('u', 'y', 'w', 'x', 'y', 'z');

$r = array();
for($i=0; $i<count foo print_r function if return foreach as . class="clear">
                 
              
              
        
            </count>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn