
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

973 Views
Suppose we have a digit d, we shall have to convert it into words. So if d = 9, our output should be "Nine". If we provide some d which is beyond the range of 0 and 9, it will return appropriate output.So, if the input is like d = 3, then the output will be "Three".To solve this, we will follow these steps −Define a function solve(), this will take d, if d < 0 and d > 9, then:return ("Beyond range of 0 - 9")otherwise when d is same as 0, then:return ("Zero")otherwise when d is same as ... Read More

102 Views
Suppose, there are n number of hostel rooms numbered from 0 to n-1. The students in the hostel rooms want to transfer to another room, and they place several requests to do that. No hostel seat remains vacant, a transfer request is only taken care of if another student takes the place of the student willing to transfer. So, given the requests, we have to find out how many requests can be satisfied.So, if the input is like n = 3, requests = [[0, 2], [1, 0], [2, 1]], then the output will be 3.The student in room 0 transfers ... Read More

3K+ Views
Suppose we have two numbers a and b, a is integer and b is a float. We shall have to take them from standard input and display the sum.So, if the input is like a = 10 b = 56.23, then the output will be Sum: 66.23To solve this, we will follow these steps −To display output into the standard output device we can use extraction operator ()ExampleLet us see the following implementation to get better understanding −#include using namespace std; int main(){ int a; float b; cout a >> b; cout

422 Views
Suppose, we are given a grid where the cells contain various symbols such as 'X', 'O', '*' and '#' and the symbols have various meanings.'#' is the goal cell that we want to reach.'O' is a free cell via which we can travel to the goal cell.'*' is our position in the cell.'X' is a blocked cell, via which we cannot travel.We have to find out the number of moves required to reach the goal cell from our current position in the grid. If the goal is not reachable, we return -1. The grid is given as input to the ... Read More

321 Views
Suppose we have an m x n binary matrix, we can rearrange the columns of the matrix in any order. We have to find the area of the largest submatrix within matrix where every element of the submatrix is 1 after performing some reordering task.So, if the input is like101111001then the output will be 4 because, after column swapping we are getting matrix like110111010here maximum submatrix is of square sized with four 1's.To solve this, we will follow these steps −row := number of rows of matrix, col := number of columns of matrixfor j in range 0 to col ... Read More

497 Views
Suppose we have an array nums with unique positive values, we have to find the number of tuples (a, b, c, d) such that a*b = c*d where a, b, c, and d are elements of nums, and all elements a, b, c and d are distinct.So, if the input is like nums = [2, 3, 4, 6], then the output will be 8 because we can get tuples like (2, 6, 3, 4), (2, 6, 4, 3), (6, 2, 3, 4), (6, 2, 4, 3), (3, 4, 2, 6), (4, 3, 2, 6), (3, 4, 6, 2), (4, 3, ... Read More

198 Views
Suppose we have three numbers i, j and k and another number n. We shall have to find the list of all triplets (i, j, k) for which i+j+k not same as n. We shall have to solve this problem using list comprehension strategy.So, if the input is like i = 1, j = 1, z = 2 and n = 3, then the output will be [[0, 0, 0], [0, 0, 1], [0, 0, 2], [0, 1, 0], [0, 1, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 2]]To solve this, we will follow these ... Read More

302 Views
Suppose we have two integer arrays, src and tgt, both are of same length. We also have an array allowedSwaps where allowedSwaps[i] contains a pair (ai, bi) indicates that we can swap the elements at index ai with element index bi of the array src. (We can swap elements at a specific pair of indices as many times as we want in any order). As we know the Hamming distance of two arrays of the same length, src and tgt, is the number of positions where the elements are different. We have to find the minimum Hamming distance of src ... Read More

1K+ Views
Suppose we have a number n. We shall have to check whether n is weird or not. Here a number is weird when − 1. The number is odd 2. The number is not in range 2 to 5 3. The number is even and in range 6 to 20So, if the input is like n = 18, then the output will be Weird because it is even and in range 6 to 20.To solve this, we will follow these steps −if n is odd, thenreturn "Weird"otherwise when (n > 1 and n < 6) or n > 20, thenreturn ... Read More

313 Views
Suppose we have a list of numbers nums. We also have a list of queries where queries[i] contains three elements [k, p, r], for each query we shall have to find kpr_sum. The formula for kpr_sum is like below.$$\mathrm{{𝑘𝑝𝑟}\_{𝑠𝑢𝑚} =\sum_{\substack{𝑖=𝑃}}^{𝑅−1}\sum_{\substack{𝑗=𝑖+1}}^{𝑅}(𝐾 ⊕(𝐴[𝑖]⊕𝐴[𝑗]))}$$If the sum is too large, then return sum modulo 10^9+7.So, if the input is like nums = [1, 2, 3] queries = [[1, 1, 3], [2, 1, 3]], then the output will be [5, 4] because for the first element it is (1 XOR (1 XOR 2)) + (1 XOR (1 XOR 3)) + (1 XOR (2 XOR 3)) ... Read More