Check if divisible by 11
Basic Accuracy: 32.26% Submissions: 31 Points: 1

Given a number S. Check whether it is divisble by 11 or not.

Example 1:

S = 76945
Output: 1
Explanation: The number is divisible by 11
as 76945 % 11 = 0.

​Example 2:

S = 12
Output: 0
Explanation: The number is not divisible
by 11 as 12 % 11 = 1.

Your Task:
You don't need to read input or print anything. Your task is to complete the function divisibleBy11() which takes the number in the form of string S as input and returns 1 if the number is divisible by 11. Else, it returns 0.

Expected Time Complexity: O(Log S) where S is the input number.
Expected Auxiliary Space: O(1). 




to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.