
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

337 Views
Sorting is a task used to organize the numbers in increasing order. Usually, we use the sorting algorithms to do this, but in most cases, the array is almost sorted, with two or three numbers in the wrong position. In such scenarios, instead of sorting the entire array, we can check if swapping just one pair of elements will make the entire array sorted. Checking if Array can be Sorted with One Swap The given task is to check if an array can be sorted with one swap in Python. i.e., given an array with distinct integers, we need ... Read More

119 Views
In this article we are going to check whether the given array can be divided into two sub-array in such a way that the absolute difference between the sums of these two sub-array is equal to the given value k. The absolute difference is nothing but the non-negative gap between two numbers, calculated as abs(sum1-sum2). In this task the split must produce two non-empty sub-array i.e. at least one element should be present in each part. Example scenarios Following are the example scenarios: Scenario 1 Input: array = [3, 1, 4, 2, 2], K = 4 ... Read More

903 Views
Suppose, we are given a set of intervals that consists of values (time1, time2) where time1 represents the starting time, and time2 represents the ending time of an event. Our task is to check whether any of these intervals overlap any other interval in this set. If any of the intervals overlap, we return the result as True, otherwise we return False.So, if the input is like [(4, 7), (5, 11), (7, 11), (5, 8)] then the output will be True.To solve this, we will follow these steps −sort the list inputArrfor i in range 1 to size of inputArr, ... Read More

188 Views
Dividing a Square into two Equal Parts In this article, we are given a square of size n*n with exactly one cell coloured. The task is to determine whether this square can be divided into two equal splits by making a single straight cut along the square, ensuring that the coloured cell lies entirely within one of the splits. Two equal splits here indicate that both parts must contain the same number of cells, which is possible if the square side length is even. In this article we are not only checking whether the split is possible but also whether the ... Read More

167 Views
Suppose, we have two positive integers n and m, such that 2 ≤ n ≤ 1018 and 2 ≤ m ≤ n. Our goal is to find out if there are any all-digit-permutations of the number n; so that it is equal to some power of m. If there is one, we state that there exists an all-digit-permutation of n that is equal to a power of m, otherwise we state the previous statement as false.For example, we are given n = 7182 and m = 12. As 1728 is an all-digit-permutation of 7182 and 1728 = 12^3, we state ... Read More

198 Views
Divisibility by 3 The given task is to determine whether the permutation of the digits of the given number can form a new number that satisfies two conditions: it must be divisible by 3 and also be a palindromic number. A number is said to be palindromic if the reversal of a number is the same as the original, such as 121 or 1331, and a number is said to be divisible by 3 if the sum of its digits is divisible by 3. For example, let's look at the following scenarios: Scenario 1 Input: 121 Output: False Explanation: ... Read More

933 Views
Divisibility By 8 According to the divisibility rule of 8, if the last three digits of a number are divisible by 8, then the entire number is divisible by 8. While this is easy to check for small numbers, when it comes to large numbers, generating all the possible permutations is impractical for large inputs. However, we can solve this problem by taking advantage of the divisibility rule and limiting our check to possible combinations of three digits. Scenario 1 Input: "61" Output: Yes Explanation: For the given input, the possible permutations of the digits are 16 and 61. Among ... Read More

415 Views
In mathematics, Divisibility helps us to determine whether a number can be divided by another without leaving a remainder. For example, 6 is divisible by 2 because 6/2 = 3 with no remainder. In this article, we are going to learn how to check if any large number is divisible by 19 or not in Python. Checking if any Large Number is Divisible by 19 Checking for the divisibility with small numbers can be easily handled by using the standard arithmetic operations. While dealing with the large numbers (contains 20, 30 or even 100 digits), the programming languages may run ... Read More

700 Views
Suppose, we are given a number and we have to check whether the number is divisible by 17.So, if the input is like 99943, then the output will be Divisible.We will solve this problem using the repeated subtraction method, where we extract the last digit of the number and subtract it 5 times from the number until we get a two-digit number that is divisible by 17.To solve this, we will follow these steps −while number is divisible by 100, dolast_digit := number mod 10number := floor value of (number divided by 10)number := number - last_digit * 5return true ... Read More