Given a positive integers N, the task is to find the smallest N digit number divisible by N. Examples: Input: N = 4 Output: 1000 Explanation: 1000 is the smallest 4-digit number ...read more
Given an array arr[] of integer elements, the task is to find the length of the largest sub-array of arr[] such that all the elements of the sub-array are Fibonacci numbers. Examples: ...read more
Given an array containing n numbers. The problem is to find the length of the longest zigZag subarray such that every element in the subarray should be in form a < b ...read more
Given a Matrix, get index of rows with K as elements. Input : test_list = [[4, 5, 6], [1, 4, 5], [6, 9, 1], [0, 3 ,1]], K = 6 Output : ...read more
Generally, we use swapcase() to swap strings in Python. What if we are asked to do swapping without using the method. In this article, I will be sharing python program to swap ...read more
Given a set, test if any element from range exists in set. Input : test_set = {1, 5, 2, 7, 3, 4, 10, 14}, strt, end = 8, 12 Output : True ...read more
Given a tuple list with probability, get a random tuple. Input : test_list = [(4, 5), (7, 6), (1, 0), (3, 4)], prob_list = [0.4, 0.3, 0.1, 0.2] Output : [(7, 6)] ...read more
Given a binary matrix of order m*n, the task is to find the distance of nearest 1 for each 0 in the matrix and print final distance matrix. From any cell (i,j), ...read more
Given a positive integer N, the task is to check whether the given number N is Even or Odd. Examples: Input : N = 10 Output : Even Input : N = ...read more
Given two numbers A and B, the task is to calculate GCD of A and B. Examples: Input : A = 4, B = 6 Output : 2 Input : A = ...read more