惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Palo Alto Networks Blog
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
Schneier on Security
Engineering at Meta
Engineering at Meta
I
InfoQ
L
LangChain Blog
Cyberwarzone
Cyberwarzone
T
Tenable Blog
WordPress大学
WordPress大学
P
Privacy & Cybersecurity Law Blog
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Jina AI
Jina AI
C
CERT Recently Published Vulnerability Notes
Scott Helme
Scott Helme
博客园 - 三生石上(FineUI控件)
酷 壳 – CoolShell
酷 壳 – CoolShell
Know Your Adversary
Know Your Adversary
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Last Watchdog
The Last Watchdog
Last Week in AI
Last Week in AI
Cloudbric
Cloudbric
S
SegmentFault 最新的问题
爱范儿
爱范儿
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
AI
AI
T
Tor Project blog
I
Intezer
T
Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Visual Studio Blog
N
News and Events Feed by Topic
Latest news
Latest news
S
Security Affairs
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog RSS Feed
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
S
Securelist

博客园 - 程序猿101

2024年总结。。。。2025年规划。 八皇后问题c语言版(xcode下通过) 对分布式一些理解 观察者模式 用redis实现悲观锁(后端语言以php为例) 只用200行Go代码写一个自己的区块链!(转) 用户中心 - 博客园 php的生命周期的概述 linux网络编程1 最简单的socket编程 mysql 慢查询 2016年终总结。。。六年从创业到技术的历程 Linux下chkconfig命令详解 这个简单明了啊 JS的prototype和__proto__ Constructor vagrant homestead laravel 编程环境搭建 发现一个百度的密码。。。记最近一段时间的php感想 mysql 的简单优化 百度面试题 字符串相似度 算法 similar_text 和页面相似度算法 PHP性能优化工具–xhprof安装 Ecshop :后台添加新功能 菜单及 管理权限 配置
百度的面试题 合并两个有序的数组
程序猿101 · 2016-03-03 · via 博客园 - 程序猿101
 1 $a = array(1,3,6,10,29,37,44);
 2 $b = array(2,5,14,19,28,55,73);
 3 $c = array();
 4 
 5 $countA = count($a);
 6 $countB = count($b);
 7 
 8 $pointA = 0;
 9 $pointB = 0;
10 
11 while($pointA < $countA || $pointB < $countB){  //结束条件是两个数组的指针都大于数组的数量
12     if($pointA < $countA && $pointB < $countB){  //分三种情况,两个数组都有数据
13         if($a[$pointA] > $b[$pointB]){  //如果a数组中的大于b数组的,那么把小的一个放在c数组,然后b数组中的指针加1
14             $c[] = $b[$pointB];
15             //echo $pointB;
16             $pointB++;
17         }else{
18             $c[] = $a[$pointA];   //否则的话把a数组的中数组放在c数组中,a的指针加1
19             //echo $pointB;
20             $pointA++;
21         }
22     }elseif($pointA >= $countA){  //a数组的没有数据了
23         $c[] = $b[$pointB];
24         $pointB++;
25     }elseif($pointB >= $countB){
26         $c[] = $a[$pointA];
27         $pointA++;
28     }
29 }
30 echo "<pre>";
31 print_r($c);