Heim  >  Artikel  >  Backend-Entwicklung  >  google的一道面试题目大家来试下解决办法

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

WBOY
WBOYOriginal
2016-06-13 13:33:00848Durchsuche

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>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn