当前位置:网站首页>力扣------用栈操作构建数组
力扣------用栈操作构建数组
2022-08-11 00:05:00 【qq_37760746】
/** * Note: The returned array must be malloced, assume caller calls free(). */
char ** buildArray(int* target, int targetSize, int n, int* returnSize){
*returnSize=0;
char **ans=(char**)calloc(200,sizeof(char*));
int b=0;
for(int a=1;a<=n;a++){
ans[*returnSize]=(char*)calloc(5,sizeof(char));
strcpy(ans[*returnSize], "Push\0");
*returnSize=*returnSize+1;
if(target[b]!=a){
ans[*returnSize]=(char*)calloc(4,sizeof(char));
strcpy(ans[*returnSize], "Pop\0");
*returnSize=*returnSize+1;
}
else{
b++;
}
if(b==targetSize){
break;
}
}
return ans;
}
边栏推荐
- 详解JDBC的实现与优化(万字详解)
- Cache knowledge summary
- [Excel knowledge and skills] Convert text numbers to numeric format
- input输入框超出部分用省略号表示以及判断内容是否有超出(PC端)
- [Excel知识技能] 将数值格式数字转换为文本格式
- 全排列思路详解
- Based on the SSM to reach the phone sales mall system
- 2022下半年软考「高项」易混淆知识点汇总(2)
- Software Testing Certificate (1) - Software Evaluator
- "NIO Cup" 2022 Nioke Summer Multi-School Training Camp 2 DGHJKL Problem Solution
猜你喜欢
sqlmap结合dnslog快速注入
Go项目配置管理神器之viper使用详解
[C Language Chapter] Detailed explanation of bitwise operators (“<<”, “>>”, “&”, “|”, “^”, “~”)
从0开始设计JVM ,忘记名词跟上思路一次搞懂
Jvm.分析工具(jconsole,jvisualvm,arthas,jprofiler,mat)
[C language] First understanding of pointers
Ali P7 bask in January payroll: hard to fill the, really sweet...
Dump文件生成,内容,以及分析
【爬虫】scrapy创建运行爬虫、解析页面(嵌套url)、自定义中间件(设置UserAgent和代理IP)、自定义管道(保存到mysql)
EPro-PnP: Generalized End-to-End Probabilistic Perspective-n-Points for Monocular Object Pose Est...
随机推荐
How engineers treat open source
CF1286E-Fedya the Potter Strikes Back【KMP,RMQ】
IEEE的论文哪里可以下载?
Multilingual Translation - Multilingual Translation Software Free
"NIO Cup" 2022 Nioke Summer Multi-School Training Camp 3 DF Problem Solving
【pypdf2】安装、读取和保存、访问页面、获取文本、读写元数据、加密解密
两个数组的交集
2022下半年软考「高项」易混淆知识点汇总(2)
12. Handling JSON
10. Notes on receiving parameters
15. Interceptor - HandlerInterceptor
How to do patent mining, the key is to find patent points, in fact, it is not too difficult
9. Rest style request processing
91.(cesium之家)cesium火箭发射模拟
Based on the SSM to reach the phone sales mall system
Software protection scenario of NOR FLASH flash memory chip ID application
[Excel知识技能] 将“假“日期转为“真“日期格式
SQL注入基础---order by \ limit \ 宽字节注入
盘点美军的无人机家底
8. WEB 开发-静态资源访问