Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
move zeros to end of array
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void moveZeroes(int[] nums) { int pos = 0; for(int i = 0;i<nums.length;i++){ if(nums[i]!=0){ int tmp = nums[pos]; nums[pos] = nums[i]; nums[i] = tmp; pos++; } } for(int i:nums) System.out.print(i+","); } public static void main(String args[]) { System.out.println("Hello, World!"); moveZeroes(new int[]{1,0,2,3,0,4}); } }
run
|
edit
|
history
|
help
0
AVL-GO-FLAT
jb12.0 threads.enums
191fa07050(1(D))
Problem_OnOff
OBF-7
Counter.java
Case 2nd Clear
Day 2
1
Arredondamento de datas para dias 10, 20 e 30