Move all odd positioned element to left half and even positioned to right half in-place

前端 未结 5 1659
别跟我提以往
别跟我提以往 2020-12-01 03:49

Given an array with positive and negative integers, move all the odd indexed elements to the left and even indexed elements to the right.

The difficult part of the p

5条回答
  •  心在旅途
    2020-12-01 04:34

    public class OddToLeftEvenToRight {
    
        private static void doIt(String input){
    
            char[] inp = input.toCharArray();
            int len = inp.length;
    
            for(int j=1; j< len; j++)
            {
                for(int i=j; i

    This program does it in O(n^2).

提交回复
热议问题