标签:comm bsp php long 截取 pre ref 最长公共前缀 val
$prefix = ‘‘;
$i = 0;
if(count($strs)<1){
return $prefix;
}
while(true){
$current = $strs[0]{$i};
if(!$current){
return $prefix;
}
foreach($strs as $str){
if($str{$i} != $current){
return $prefix;
}
}
$prefix .= $current;
$i++;
}
return $prefix;
作者:yytswcx
标签:comm bsp php long 截取 pre ref 最长公共前缀 val
原文地址:https://www.cnblogs.com/corvus/p/12000732.html