0
how to print arrays even and odd numbers alternatively?
Example Input:{1,2,5,6,3,2} output:{2,1,2,3,6,5}
8 ответов
+ 4
Job interview? If so, that isn't a big deal as long as you were honest about your Java knowledge. Pretend to be better than you are and you won't be hired. Lying about knowledge will be discovered and you won't be considered no matter how badly they need you. If they know the truth, they base hiring on how well they think you will fit in.
+ 3
Is this homework? Maybe you missed the input should be sorted step. Sorting it would yield that output in your original post.
+ 2
I would have expected output of: {2,1,6,5,2,3}. Nothing in your statement suggested jumping around in the array so the next even number from the beginning is 6.
+ 2
I'd sort numbers as you insert them using a lists one odd the other even. I assume they only verify output so how you code it doesn't matter.
https://www.geeksforgeeks.org/list-interface-java-examples/
+ 1
Yes
+ 1
No its asked in my interview, im not able to do this.
+ 1
i would do it like this: split into 2 arrays odd & even, sort those arrays, and combine them back in one array alternating odd & even using a loop
0
Its not job interview, its just online mock interview. Im new to java jus learning through sololearn. Jus tried for some online java test. If not interested to explain about this means jus you leave it. Don't discourage anyone and don't hurt anyone.