
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 10476 Articles for Python

732 Views
SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible. SymPy is written entirely in Python. SymPy only depends on mpmath, a pure Python library for arbitrary floating point arithmetic, making it easy to use.#Installing sympy modulepip install sympySymPy defines following numerical types: Rational and Integer. The Rational class represents a rational number as a pair of two Integers, numerator and denominator, so Rational(1, 2) represents 1/2, Rational(5, 2) 5/2 and so on. The Integer class represents Integer number.SymPy ... Read More

2K+ Views
We are given with an array of integer type elements and the task is to find the maximum factors formed by multiplying two numbers i.e. firstly we will multiply the numbers present in an array like calculating cross product secondly, we will calculate the factors of those numbers and check for the maximum factors amongst all.Inputint arr[] = {3, 2, 10}OutputMaximum factors formed by two numbers are: 8ExplanationCalculate the inner cross product i.e. 3 * 2 = 6, 3 * 10 = 30, 2 * 10 = 20Now calculate the factors for 6 -> 1, 2, 3, 6 ; 30 ... Read More

567 Views
Suppose we have a bitonic sequence, we have to find the Bitonic Point in it. As we know a Bitonic Sequence is a sequence of numbers which is first strictly increasing then after a certain point it is strictly decreasing. This point is bitonic point. For only increasing or only decreasing sequences, bitonic points are not available.So, if the input is like [7, 8, 9, 12, 10, 6, 3, 2], then the output will be 12To solve this, we will follow these steps −define a function binary_search(array, l, r)if l array[m + 1], then −return mif array[m] < array[m ... Read More

133 Views
Suppose we have two numbers a and b, we have to find an array containing values in range [1, a] and requires exactly b number of calls of recursive merge sort function.So, if the input is like a = 10, b = 15, then the output will be [3, 1, 4, 6, 2, 8, 5, 9, 10, 7]To solve this, we will follow these steps −Define a function solve() . This will take left, right, array, bif b < 1 or left + 1 is same as right, thenreturnb := b - 2mid := (left + right) / 2temp := ... Read More

151 Views
Suppose we have an array of size N; we have to find an element which divides the array into two different sub-arrays with equal product. Return -1 if no such partition is possible.So, if the input is like [2, 5, 3, 2, 5], then the output will be 3 then subarrays are: {2, 5} and {2, 5}To solve this, we will follow these steps −n := size of arraymultiply_pref := a new listinsert array[0] at the end of multiply_preffor i in range 1 to n, doinsert multiply_pref[i-1]*array[i] at the end of multiply_prefmultiply_suff := a list of size n, and fill ... Read More

644 Views
Suppose we have an array of positive numbers; we have to check a point/item up to which items create a strictly decreasing sequence first followed by a sequence of strictly increasing integers. These are the following properties: We have to keep in mind that the sequences must be of minimum length 2Also, we have taken care that the last value of the decreasing sequence is the first value of the increasing sequence.So, if the input is like {5, 4, 3, 4}, then the output will be 3, as {5, 4, 3} is strictly decreasing then {3, 4} is strictly increasing.To ... Read More

259 Views
Suppose we have a character mapping as follows, here each digit, from 1 to 9, maps to few characters.1 -> ['A', 'B', 'C'] 2 -> ['D', 'E', 'F'] 3 -> ['G', 'H', 'I'] 4 -> ['J', 'K', 'L'] 5 -> ['M', 'N', 'O'] 6 -> ['P', 'Q', 'R'] 7 -> ['S', 'T', 'U'] 8 -> ['V', 'W', 'X'] 9 -> ['Y', 'Z']If we have a number, we have to change its digits with corresponding characters in given mapping list and show all generated strings. We should consider same character for every occurrence of a digit in the number. The given ... Read More

384 Views
Suppose we have a binary 2D matrix, now we have to find the beginning point and terminating point of all rectangles filled with 0s. We have to keep in mind that rectangles are separated and do not touch each other however they can touch the array boundary. A rectangle with only single element is also possible.So, if the input is like −10111011101111101100110110011011011101000011100011011101then the output will be [[0, 1, 0, 1], [0, 5, 0, 5], [1, 2, 1, 2], [2, 3, 2, 4], [3, 1, 5, 1], [3, 4, 6, 5], [5, 3, 6, 5], [7, 1, 7, 1], [7, 5, ... Read More

134 Views
Suppose we have a string; we have to find all the palindromic sub-strings from that string. Here aa and aa are considered as two sub-strings, not one.So, if the input is like redivider, then the output will be ['r', 'e', 'd', 'i', 'v', 'ivi', 'divid', 'edivide', 'redivider', 'i', 'd', 'e', 'r']To solve this, we will follow these steps −v := a new listpos := 0.0while pos < size of s, dorad := pos - (pos as integer)while (pos + rad) < size of s and (pos - rad) >= 0 and (s[integer of (pos - rad)] is same as s[integer ... Read More

553 Views
Suppose we have an array A of numbers, we have to find all indices of this array so that after deleting the ith element from the array, the array will be a good array. We have to keep in mind that −Good array is an array with an element that equals to the sum of all other elements.1-based indexing will be used here.So, if the input is like [10, 4, 6, 2], then the output will be [1, 4] as when we remove A[1], the array will look like [4, 6, 2] and it is good, as 6 = 4+2. ... Read More