fix45 java solution code example
Example: fix45 codingbat solution
public int[] fix45(int[] nums) {
for (int i=0;i<nums.length;i++){
if (nums[i]==4){
int temp=nums[i+1];
nums[i+1]=143;
for (int j=0;j<nums.length;j++){
if (nums[j]==5){
nums[j]=temp;
}
}
}
}
for (int i=0;i< nums.length;i++){
if (nums[i]==143){
nums[i]=5;
}
}
return nums;
}
/// Thank You