Bloomberg 面试题05012012[1]
来源:互联网 发布:mysql密码字典 编辑:程序博客网 时间:2024/06/05 14:12
Given an unsorted integer array, place all zeros to the end of the array without changing the sequence of non-zero elements. (i.e. [1,3,0,8,12, 0, 4, 0,7] --> [1,3,8,12,4,7,0,0,0])
#include <iostream>int main(){int a[9] = {1, 3, 0, 8, 12, 0, 4, 0, 7};int first = 0, cur = 0;for(; cur < 9; cur++){if(a[cur] != 0){a[first] = a[cur];first++;}}for(; first < 9; first++){a[first] = 0;}for(int i = 0; i < 9; i++){printf("%d ", a[i]);}printf("\n");return 0;}
- Bloomberg 面试题05012012[1]
- Bloomberg 面试题05012012[2]
- Bloomberg 面试题05012012[3]
- Bloomberg 面试题05032012[1]
- Bloomberg面试题04032012
- Bloomberg面经
- QWQ电面总结:Bloomberg
- Bloomberg 05102012 [1]
- Bloomberg 05122012 [1]
- [面试题] 随机数相关面试题(1)
- java面试题1
- JAVA面试题-1
- 华为面试题1
- C#面试题 1
- 英文面试题(1)
- 面试题1-- Intel
- C++面试题1
- 面试题(1)
- 基于Android的Linux内核的电源管理:Early Suspend
- Delegate
- UpdateControls方法 UpdateRecord方法
- mysql函数大全
- 项目中常见的SQL处理总结【二】
- Bloomberg 面试题05012012[1]
- 翻译:Linux的电源管理架构
- metro开发资料整理~
- 让Android adb运行在ARM平台上
- 字符转码
- fedora16无线网卡安装
- 你若安好,便是晴天
- 如何在Ubuntu11.10(32位)下载Android4.0源码(图文)
- 装机——跳线