
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 26504 Articles for Server Side Programming

544 Views
Suppose we have one integer array called nums. The value of this array is defined as the sum of |nums[i]-nums[i+1]| for all i in range 0 to n - 1. Where n is the size of the array. We can select any subarray of the given array and reverse it. We can perform this operation only once. Then we have to find the maximum possible value of the final array.So, if the input is like [1, 5, 4, 2, 3], then the output will be 10.To solve this, we will follow these steps −ret := 0, extra := 0n := ... Read More

365 Views
Suppose there is a one-dimensional garden on the x-axis. The starting position of the garden is 0, and ending position is n. There are n + 1 taps located at points [0, 1, ..., n] in the garden. If we have an integer n and an integer array ranges of length n + 1 where ranges[i] is the i-th tap can water the area [i - ranges[i], i + ranges[i]] when that area is open.We have to find the minimum number of taps that should be open to water the whole garden, if there is no possible solution, then return ... Read More

268 Views
Suppose we have a keyboard layout like below −ABCDEFGHIJKLMNOPQRSTUVWXYZWhere each English uppercase letter is located at some coordinate, as an example, the letter A is placed at (0, 0), the letter B is placed at (0, 1), the letter P is placed at (2, 3) and the letter Z is placed at (4, 1). Now if we have a word, we have to find the minimum total distance to type such string using only two fingers. The distance between two places (x1, y1) and (x2, y2) is |x1 - x2| + |y1 - y2|. And we can start from any ... Read More

172 Views
Suppose we have a string S; we have to find the number of distinct non-empty substrings of S that can be written as the concatenation of some string with itself.So, if the input is like "elloelloello", then the output will be 5, as there are some substrings like "ello", "lloe", "loel", "oell".To solve this, we will follow these steps −prime := 31m := 1^9 + 7Define a function fastPow(), this will take base, power, res := 1while power > 0, do −if power & 1 is non-zero, then −res := res * baseres := res mod mbase := base * ... Read More

493 Views
Suppose we have an equation, expressions are represented by words on left side and the result on right side. We have to check whether the equation is solvable under the following rules or not −Each character is decoded as one digit (0 to 9).Every pair of different characters must map to different digits.Each words[i] and result are decoded as a number where no leading zeros are present.Sum of numbers on left side will equal to the number on right side.We will check whether the equation is solvable or not.So, if the input is like words = ["SEND", "MORE"], result = ... Read More

190 Views
Suppose we have a square board of characters. We can move on the board starting at the bottom right square marked with the character 'S'. Now we need to reach the top left square marked with the character 'E'. The other squares are labeled either with a numeric character from 1 to 9 or with an obstacle 'X'. In one move we can go up, left or up-left only when there is no obstacle there.We have to find the list of two numbers: the first number is the maximum sum of the numeric characters we can collect, and the second ... Read More

399 Views
Suppose we have n boxes, here each box is given in the format like [status, candies, keys, containedBoxes] there are some constraints −status[i]: an is 1 when box[i] is open and 0 when box[i] is closed.candies[i]: is the number of candies in box[i].keys[i]: is an array contains the indices of the boxes we can open with the key in box[i].containedBoxes[i]: an array contains the indices of the boxes found in box[i].We will start with some boxes given in initialBoxes array. We can take all the candies in any open box and we can use the keys in it to open ... Read More

601 Views
Suppose we have a m x n grid, here each cell is either 0 or 1. 0 cell is empty and 1 is blocked. In one step, we can move up, down, left or right from and to an empty cell. We have to find the minimum number of steps to walk from the upper left corner cell (0, 0) to the lower right corner cell (m-1, n-1) given that we can eliminate at most k obstacles. If there is no such way, then return -1.So, if the input is like000110000011000and k is 1, then the output will be 6, ... Read More

301 Views
Suppose we have a grid arr, this is a square grid, a falling path with non-zero shifts is a choice of exactly one element from each row of arr, such that no two elements chosen in adjacent rows are present in the same column. We have to find the minimum sum of a falling path with nonzero shifts.So, if the input is like arr is like [[1, 2, 3], [4, 5, 6], [7, 8, 9]], then the output will be 13, as there are different falling paths, these are like [1, 5, 9], [1, 5, 7], [1, 6, 7], [1, ... Read More

274 Views
Suppose there is an array of size arrLen, and we also have a pointer at index 0 in that array. At each step, we can move 1 position to the left, 1 position to the right in the array or stay in the same place.Now suppose we have two integers steps and arrLen, we have to find the number of ways such that the pointer still at index 0 after exactly steps. If the answer is very large then return it modulo 10^9 + 7.So, if the input is like steps = 3, arrLen = 2, then the output will ... Read More