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

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

WBOY
Release: 2016-06-13 13:33:00
Original
895 people have browsed it

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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template