LintCode问题图解-18

作者: billliu_0d62 | 来源:发表于2017-10-18 10:51 被阅读8次

本文准备讲解1个简单的算法编程问题, 这个算法编程问题来自LintCode平台。不了解.LintCode平台的读者可以阅读笔者文章(在线编程平台推荐-LeetCode)。问题的英文版本描述如下:

Interleaving Positive with Negative Numbers

For an array with positive and negative integers, re-arrange it. Interleave positive with negative integers.

Example

Given [-1, -2, -3, 4, 5, 6], after re-arrange, it will be [-1, 5, -2, 4, -3, 6] or any other reasonable.

正负数交替排列

给出一个含有正整数和负整数的数组,重新排列成正负数交替出现的数组。

样例

给出数组[-1, -2, -3, 4, 5, 6],重新排列数组元素之后,变成[-1, 5, -2, 4, -3, 6]或者其他任何满足要求的答案

题目要求分类处理数组元素。

简单高效的算法

相关文章

  • LintCode问题图解-18

    本文准备讲解1个简单的算法编程问题, 这个算法编程问题来自LintCode平台。不了解.LintCode平台的读者...

  • LintCode问题图解-1

    本文准备讲解1个简单的算法编程问题, 这个算法编程问题来自LintCode平台。不了解.LintCode平台的读...

  • LintCode问题图解-61

    本文准备讲解1个简单的算法编程问题, 这个算法编程问题来自LintCode平台。不了解.LintCode平台的读者...

  • LintCode问题图解-49

    本文准备讲解1个算法编程问题, 这个算法编程问题来自LintCode平台。不了解.LintCode平台的读者可以阅...

  • LintCode问题图解-52

    本文准备讲解1个算法编程问题, 这个算法编程问题来自LintCode平台。不了解.LintCode平台的读者可以阅...

  • LintCode问题图解-56

    本文准备讲解1个简单的算法编程问题, 这个算法编程问题来自LintCode平台。不了解.LintCode平台的读者...

  • LintCode问题图解-55

    本文准备讲解1个算法编程问题, 这个算法编程问题来自LintCode平台。不了解.LintCode平台的读者可以阅...

  • LintCode问题图解-53

    本文准备讲解1个算法编程问题, 这个算法编程问题来自LintCode平台。不了解.LintCode平台的读者可以阅...

  • LintCode问题图解-54

    本文准备讲解1个简单的算法编程问题, 这个算法编程问题来自LintCode平台。不了解.LintCode平台的读者...

  • LintCode问题图解-63

    本文准备讲解1个算法编程问题, 这个算法编程问题来自LintCode平台。不了解.LintCode平台的读者可以阅...

网友评论

    本文标题:LintCode问题图解-18

    本文链接:https://www.haomeiwen.com/subject/xqusuxtx.html