
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

178 Views
Suppose we have an array A with n elements and another number k. There are n piles of candies. The ith pile has A[i] number of candies. We can perform the operation on two indices i and j (i != j), then add another A[i] number of candies to A[i] (A[i] will not be reduced). We can perform this operation any number of times, but unfortunately if some pile contains strictly more than k candies we cannot perform the operation anymore. We have to find the maximum number of times we can perform this operation.So, if the input is like ... Read More

169 Views
Suppose we have a string S of length . Consider there are n numbers and they are arranged in a circle. We do not know the values of these numbers but if S[i] = 'E' it indicates ith and (i+1)th numbers are same, but if that is 'N' then they are different. From S we have to check whether we can recreate the sequence or not.So, if the input is like S = "ENNEENE", then the output will be True, because we can assign values like [15, 15, 4, 20, 20, 20, 15].StepsTo solve this, we will follow these steps ... Read More

306 Views
Suppose we have a number n. We have to find two composite integers (non-prime) a and b, such that a - b = n.So, if the input is like n = 512, then the output will be 4608 and 4096StepsTo solve this, we will follow these steps −print 10*n and 9*n.ExampleLet us see the following implementation to get better understanding −#include using namespace std; void solve(int n){ cout

548 Views
Suppose we have an array A with n elements and a number m. There are n students giving an exam. The highest possible score is m. A[i] is the score of ith student. We can manipulate each students score, but the conditions must be satisfied. The score will not exceed m, all scores are integers and the average marks of all student does not change. If we want to maximize the first person's score what will be the highest possible score we can give.So, if the input is like A = [1, 2, 3, 4]; m = 10, then the ... Read More

279 Views
The arithmetic mean deviation or mean absolute deviation is the summation of the absolute differences of each element and the mean of the dataset, then dividing it by the total number of data elements. To calculate the minimum arithmetic mean deviation, we used the median of the dataset in place of the mean. The formula to calculate the minimum arithmetic mean deviation is given as: $$ \text{MMD} = \frac{1}{n} \sum_{i=1}^{n} |x_i - M| = \frac{|x_1 - M| + |x_2 - M| + \cdots + |x_n - M|}{n} $$ Here are some example scenarios to calculate the ... Read More

190 Views
Suppose, we are given a rotary dial that contains all lowercase English alphabets. There is a printer attached to the dial and whichever character resides in the pointer of the rotary dial for 3 seconds, gets printed. The rotary dial initially stays at the letter 'a' and it does not reset to the initial position whenever it prints a character. We are given a string s and we have to print the given string. Whenever we move the dial to another letter, one amount of rotation takes place. We have to find out the total amount of rotations needed to ... Read More

456 Views
Suppose, there is a floor divided into a grid that has n rows and m columns. Now the floor has to be lit using lamps. A lamp, if placed at the border of two cells can light up two cells. If the lamp is placed in the vertical border, it lights up the cells to its left and right and if it is placed in the horizontal border, it lights up cells to its front and back. Given n and m, we have to find out the minimum number of lamps needed to light up the whole floor.So, if the ... Read More

2K+ Views
Suppose, we are given an image that contains n pixels. The pixels can be of the following color −'C' (cyan)'M' (magenta)'Y' (yellow)'W' (white)'G' (grey)'B' (black)The color of the i-th pixel is given in the string 'pixels'. Given the string, we have to find out if the given photograph is colorful or black and white. If it is a color photograph it will contain at least one pixel of color 'C', 'M' and 'Y' and we will print 'Color'; otherwise, it will contain pixels of color 'W', 'G', 'B' only and we will print 'BW'.So, if the input is like n ... Read More

802 Views
Suppose, we are selling 4 items and the price of the i-th item is given in the array 'cost[i]'. Now we sell the items in the order given in the string 'items'. We have to find out the total amount of sales that we have made. The string 'items' contain integer numbers from 1 to 4, duplicates can be present and they can be in any order.So, if the input is like cost = {10, 15, 10, 5}, items = "14214331", then the output will be 75.StepsTo solve this, we will follow these steps −total := 0 for initialize i ... Read More