TechInfo

Secret Code CodeKaze June23 Round 2 Solution || India’s Biggest Hiring Challenge

Secret Code CodeKaze June23 Round 2 Solution || India’s Biggest Hiring Challenge

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

Secret Code CodeKaze June23 Round 2 Solution || India’s Biggest Hiring Challenge

Problem Statement

You are given an array ‘A’ of length ‘N’. Three consecutive elements are considered the ‘secret code’ if their sum is divisible by ’10’.

Return ‘1’ if the array contains the ‘secret code’ and return ‘0’ otherwise.

For Example :
Let 'N' = 4, 'A' = [ 10, 11, 21, 8 ].
There are two sets of three consecutive elements in the given array.
The first, second, and third elements make the first set, with a sum of '10 + 11 + 21 = 42', which is not divisible by '10'.
The second, third, and fourth elements make the second set, with a sum of '11 + 21 + 8 = 40', which is divisible by '10'. Therefore, the array does contain the 'secret code'.
Thus, the answer is '1'.
Hint:
Iterate through each array element and check if the last three elements are considered the 'secret code' by finding their sum and checking its divisibility by 10.
Detailed explanation ( Input/output format, Notes, Images )
Constraints :
1 <= 'T' <= 10
3 <= 'N' <= 10^5
1 <= 'A[i]' <= 10^8

Time Limit: 1 sec
Sample Input 1 :
2
5
1 2 3 4 1
4
30 10 20 10
Sample Output 1 :
0
1
Explanation Of Sample Input 1 :
First test case:-
There are three sets of three consecutive elements in the given array.
The sums of all three sets are less than '10'.
Thus, the answer is '0'.

Second test case:-
Every element is divisible by '10'.
Therefore, the sum of any three consecutive elements will be divisible by '10'.
Thus, the answer is '1'.
Sample Input 2 :
2
3
1082 1 1037
4
34 225 17 9
Sample Output 2 :
1
0
Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram


6 digit code appear after 69 seconds.
 

Wait for Solution


We are Still Solving…. Please Visit Our Social Media Handle Till Then

Here Discuss About Secret Code CodeKaze June23 Round 2 Solution || India’s Biggest Hiring Challenge

Secret Code CodeKaze June23 Round 2 Solution || India’s Biggest Hiring Challenge

 

Yhaa You have done it but next? if YOU Want to Get Others Please Visit Here ScishowEngineer   Then Follow US HERE and Join Telegram.

If You Want To Learn Something New Then Visit Our Official Channel YOUTUBE