Division of 4

Level EASY

Given an array, update each element of the array by the value obtained by dividing the element by 4 (take only integer part). If the value obtained by dividing the element by 4 comes out to be 0, then update the element with value -1.

Note: Do not return or print the array and make changes in the same array.

Input Format :
Line 1: An Integer N i.e. size of the array
Line 2: N integers which are elements of the array, separated by spaces
Output Format :
N elements of the array, separated by space
Constraints :
1 <= N <= 10^5
0 <= array[i] <= 100

Time Limit: 1 sec
Sample Input :
 2 
 3 8
Sample Output :
 -1 2
Sample Output Explanation :
The input list is [ 3, 8 ] , after dividing each element by 4, our list becomes [ 0, 2 ] . So as the first element is 0 so replace it by -1.

Comments

Popular posts from this blog

Access and modify all the resources of our Wiki.js using WikiJS API

MySQL Multi Source Master Slave Replication using GTID

How to pass parameters in webhook?