
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

238 Views
Suppose we have three numbers A, B and C. Consider a game: There are three "integer panels", each with a digit form 1 to 9 (both inclusive) printed on it, and one "operator panel" with a '+' sign printed on it. The player should make a formula of the form X+Y, by arranging the four panels from left to right. Then, the amount of the allowance will be equal to the resulting value of the formula.We have to find the maximum possible amount of the allowance.So, if the input is like A = 1; B = 5; C = 2, ... Read More

179 Views
Suppose we have a number X. We have 100 rupees in a bank. The bank returns annual interest rate of 1 % compounded annually. (Integers only). We have to check how many years we need to get X rupees?So, if the input is like X = 520, then the output will be 213.StepsTo solve this, we will follow these steps −sum := 0 balance := 100 while balance < n, do: interest := balance / 100 sum := sum + 1 balance := balance + interest return sumExampleLet us see the following implementation to get better understanding ... Read More

156 Views
Suppose we have an array A with n elements. We want to remove duplicate elements. We want to leave only the rightmost entry for each element of the array. The relative order of the remaining unique elements should not be changed.So, if the input is like A = [1, 5, 5, 1, 6, 1], then the output will be [5, 6, 1]StepsTo solve this, we will follow these steps −Define two arrays b and vis of size: 1200 each x := 0 n := size of A for initialize i := n - 1, when i >= 0, update (decrease ... Read More

226 Views
Suppose we have an array A with n elements. We select any subset of given numbers and negate these numbers. We have to find maximum number of different values in the array we can get.So, if the input is like A = [1, 1, 2, 2], then the output will be 4, because we can negate first and last numbers to make the array [-1, 1, 2, -2] with four different values.StepsTo solve this, we will follow these steps −Define one set se n := size of A for initialize i := 0, when i < n, update (increase i ... Read More

471 Views
Suppose we have a number n. As we know, a bracket sequence is a string containing only characters "(" and ")". A valid bracket sequence is a bracket sequence which can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. So, if a bracket sequence is like "()()" this is valid because we can put 1's like "(1)+(1)". From number n, we have to find exactly n different possible valid bracket sequences of length 2n.So, if the input is like n = 4, then the output will be ["()()()()", ... Read More

279 Views
Suppose we have three numbers a, b and c. We want to make a closed fence in a shape of arbitrary non-degenerate simple quadrilateral. We already have three sides of length a, b and c. We have to find another side d.So, if the input is like a = 12; b = 34; c = 56, then the output will be 42, other answers are also possible.StepsTo solve this, we will follow these steps −return a + b + c - 2ExampleLet us see the following implementation to get better understanding −#include using namespace std; int solve(int a, int ... Read More

194 Views
Suppose we have the adjacency matrix of a directed graph G. Until the graph becomes empty, we are repeating the following operation: Select one vertex from G, then erase that vertex and all vertices that are reachable from that vertex by following some edges. Erasing a vertex will also erase the edges incident to it. We have to find the expected number of times the operation is doneSo, if the input is likethen the output will be 1.6667, because initially select vertex A, remove all vertices, if we select vertex B, remove B and C, and in second operation select ... Read More

904 Views
numpy.meshgrid() is used to return coordinate matrices from coordinate vectors. Its syntax is as follows −numpy.meshgrid(*xi, **kwargs)ParametersMeshgrid can accept the following parameters −x1, x2, …, xn − It represents the coordinates of a grid.indexing − It is an optional parameter which defines the Cartesian 'xy' by default and matrix 'ij' index of output.sparse − It is an optional parameter. If we like to use sparse grid for conserving memory, then we have to set this parameter to True. By default, it is False.copy − It returns a copy of the original array for conversing memory when the parameter is True. ... Read More

145 Views
Suppose we have a number d. Consider there is an infinite number of square tiles and regular triangular tiles with sides length 1. We have to find in how many ways we can form regular dodecagon (12-sided polygon) with sides d using these tiles. If the answer is too large, return result mod 998244353.StepsTo solve this, we will follow these steps−b := floor of d/2 - 1 c := 1 for initialize i := 2, when i < d, update (increase i by 1), do: b := b * (floor of d/2) c := c * i return ... Read More

196 Views
Suppose we have a number n. We need to find two integers l and r, such that l < r and l + (l + 1) + ... + (r - 1) + r = n.So, if the input is like n = 25, then the output will be l = -2 and r = 7, because (−2) + (−1) + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 = 25. Other answers are also possible.StepsTo solve this, we will follow these steps −return -(n-1) and nExampleLet us see the following implementation to get better understanding −#include using namespace std; void solve(int n){ cout