
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

211 Views
Suppose we have an integer n, we have to find the number of positive integers that are less than or equal to n, where the integer numbers at least have a digit occurring more than once.So, if the input is like n = 200, then the output will be 38To solve this, we will follow these steps −Define an array afor initialize x := n, when x is non−zero, update x := x / 10, do −insert x mod 10 at the end of areverse the array aret := nfor initialize w := 1, d := 1, when w < ... Read More

521 Views
Suppose, we have a lowercase string s that contains letters and parentheses "(" and ")". We have to reverse every string enclosed within parentheses in a recursive manner and return the resultant string.So, if the input is like s = "back(aps)ce", then the output will be “backspace”.To solve this, we will follow these steps −Define a function trav() . This will take s, dir, start, close:= close, ans:= ansend := "(" if dir is same as −1, otherwise ")"other := "(" if end is same as ")", otherwise ")"while start < size of s, and s[start] is not same as ... Read More

229 Views
Suppose, we have a car and are driving it on a one−dimensional road. Currently we are at position = 0 and with speed = 1. We can perform any of these two operations.Acceleration: position := position + speed and speed := speed * 2 Reverse Gear: speed := −1 when speed > 0 otherwise speed := 1.We have to find the number of moves needed at least to reach the target.So, if the input is like target = 10, then the output will be 7.To solve this, we will follow these steps −Define a function dfs() . This will take ... Read More

131 Views
Suppose we are playing a unique game and we have three values n, k, and h. We start from 0 points, then we can select a number randomly between 1 and h (inclusive) and we will get that many points. We stop when we have scored a minimum of k points. We have to find the probability that we have n or fewer points. Here any number can be chosen randomly and the outcomes all have the same probability.So, if the input is like n = 2, k = 2, h = 10, then the output will be 0.11.To solve ... Read More

174 Views
Suppose we have a list of numbers. We have to find the length of the longest sequence of numbers such that when we delete a number from the sequence, each number occurs the same number of times.So, if the input is like numbers = [2, 4, 4, 7, 7, 6, 6], then the output will be 7.To solve this, we will follow these steps −num_freq := a new mapfreq_freq := a new mapdiff_freq := a new setresult := 1for each index I and value num in nums, docur_freq := num_freq[num]num_freq[num] := num_freq[num] + 1freq_freq[cur_freq] := freq_freq[cur_freq] − 1freq_freq[cur_freq + 1] ... Read More

216 Views
Suppose, we are provided with a list of numbers called nums. Here we can jump to index i + numbers[i] or to i − numbers[i] from index i if the values exist in the list. So we have to find the number of jumps required at least to reach another value with different parity keeping the order in the input unchanged. If we cannot reach another number with different parity, it is set to −1.So, if the input is like numbers = [7, 3, 4, 5, 6, 9, 6, 7], then the output will be [−1, 1, 2, −1, −1, ... Read More

161 Views
Suppose we have one infinite grid of water. We can add blocks of land to that grid one by one. We have a list of coordinates called land_requests where each coordinate is in the form [r, c] where r is for row and c is for column. We have to find a list where each element represents the number of islands that exist after adding each block of land from land_requests.So, if the input is like land_requests = [[1, 1], [2, 4], [1, 2], [1, 4], [1, 3]], then the output will be [1, 2, 2, 2, 1] asTo solve ... Read More

318 Views
Suppose we have a 2d matrix and another value k, we have to find the largest sum of a rectangle where sum ≤ k.So, if the input is like5−2710and k = 15, then the output will be 12, as we can take the rectangle [5, 7] to get sum of 12 less than 15.To solve this, we will follow these steps −n := row count of am := column count of aans := inffor i1 in range 0 to n, dorow := a list of size m and fill with 0for i2 in range i1 to n, dofor j in ... Read More

412 Views
Suppose we want to make a maximum stack, which supports following operations −MaxStk() this will construct a new instance of a maximum stackpush(val) inserts val to the stacktop() get the top most element from stackmax() get the maximum element from the stackpop() removes and returns the top most element from the stackpopmax() removes and returns the maximum element from the stackNow construct the maximum stack by calling MasStk(), then push three values like 5, 15, 10, then call top(), max(), popmax(), max() pop(), top() functions respectively. then the initial stack status will be [5, 15, 10], and corresponding output for ... Read More

302 Views
Suppose we have a list of numbers called nums, we have to find the maximum difference that exists between any number and the next smaller number. Our goal is to solve this in linear time.So, if the input is like nums = [14, 2, 6, 35, 12], then the output will be 21, as 35 and 14 have the largest difference of 21.To solve this, we will follow these steps −max_val := maximum of nums, min_val := minimum of numsif max_val is same as min_val, thenreturn 0delta := (max_val − min_val) / (size of nums − 1)min_map := an empty ... Read More