当前位置:网站首页>力扣------用栈操作构建数组
力扣------用栈操作构建数组
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;
}
边栏推荐
- App regression testing, what are the efficient testing methods?
- Is there a way out in the testing industry if it is purely business testing?
- Jvm.分析工具(jconsole,jvisualvm,arthas,jprofiler,mat)
- The Missing Semester of Your CS Education
- 5. Lombok
- sqlmap combined with dnslog fast injection
- 图片懒加载(纯手写)
- HGAME 2022 Week1 writeup
- How to recover deleted files from the recycle bin, two methods of recovering files from the recycle bin
- 深度解析volatile关键字(保证够全面)
猜你喜欢

复制带随机指针的链表——LeetCode

14. Thymeleaf

2. Dependency management and automatic configuration

7. yaml

Mysql.慢Sql

Jvm.分析工具(jconsole,jvisualvm,arthas,jprofiler,mat)

In 22 years, the salary of programmers nationwide in January was released, only to know that there are so many with annual salary of more than 400,000?

Is there a way out in the testing industry if it is purely business testing?

给肯德基打工的调料商,年赚两亿

镜头之滤光片---关于日夜两用双通滤光片
随机推荐
Server Tips
5. Lombok
详谈二叉搜索树
How to easily obtain the citation format of references?
LeetCode_优先级队列_692.前K个高频单词
CF1427F-Boring Card Game【贪心】
15. Interceptor - HandlerInterceptor
How to determine how many bases a number is?
C language% (%d,%c...)
“蔚来杯“2022牛客暑期多校训练营2 DGHJKL题解
如何便捷获取参考文献的引用格式?
[21天学习挑战赛——内核笔记](五)——devmem读写寄存器调试
【经典排序】快速排序
Jvm.分析工具(jconsole,jvisualvm,arthas,jprofiler,mat)
只会懒汉式和饿汉式 你还不懂单例模式!
LENS CRA和SENSOR CRA匹配问题解析
[C language articles] Expression evaluation (implicit type conversion, arithmetic conversion)
[Excel知识技能] 将文本型数字转换为数值格式
Summary of Confused Knowledge Points for "High Items" in the Soft Examination in the Second Half of 2022 (2)
服务器小常识