You are on page 1of 1

1. Count of sub-strings that are divisible by K?

Given an integer K and a numeric string str (all the characters are from the range [‘0’, ‘9’]).
The task is to count the number of sub-strings of str that are divisible by K.
Example:
Input: str = “33445”, K = 11
Output: 3
Sub-strings that are divisible by 11 are “33”, “44” and “3344”
Input: str = “334455”, K = 11
Output: 6

2. Print a given matrix in spiral form


Input:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
Output:
1 2 3 4 8 12 16 15 14 13 9 5 6 7 1

3. Pairs which are Divisible by 4.


Given an array if ‘n’ positive integers, count number of pairs of integers in the array that have
the sum divisible by 4.
Input:
1
5
22175
Output:
3
Explanation:
Testcase 1: (2,2), (1,7) and (7,5) are the 3 pairs.

You might also like