
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

576 Views
Suppose we have a set data structure for integer type data. In our standard input we provide n queries. In each query (in each line) we have two elements. First one is the operator, second one is the element. The operations are like below −Insert. This will insert the element into the setDelete. This will delete the element from the set (if exists)Search. This will search the element into the set, if present show Yes, otherwise No.So, if the input is like n = 7, queries = [[1, 5], [1, 8], [1, 3], [2, 8], [1, 9], [3, 8], [3, ... Read More

11K+ Views
Suppose we have a set of elements present inside a vector. We shall have to perform some remove operation using erase() function of vector class type to remove using indices, and finally display rest of elements. The erase function does not take the index directly. We shall have to pass its address by passing v.begin()+index, here v is the vector and v.begin() is the address of the first element (0th element). Now by adding index with it, it will move towards the element that is present at given index.So, if the input is like v = [5, 8, 6, 3, ... Read More

273 Views
Suppose we have two strings s and t. These two strings are K-similar when we can swap the positions of two letters in s exactly K times so that the resulting string is t. We have two anagrams s and t, and we have to find the smallest K for which s and t are K-similar.So, if the input is like s = "abc", t = "bac", then the output will be 1.To solve this, we will follow these steps −Define a function swapp(), this will take string s, i, j, x := s[i], y := s[j]s[i] := y, s[j] ... Read More

324 Views
Suppose we have an array called nums with non-negative values. We also have another array called queries where queries[i] has a pair (xi, mi). The answer of ith query is the maximum bitwise XOR value of xi and any element of nums that less than or equal to mi. If all elements in nums are larger than mi, then the answer is -1. So we have to find an array answer where size of answer is same as size of query and answer[i] is the answer to the ith query.So, if the input is like nums = [0, 1, 2, ... Read More

3K+ Views
Suppose we shall have to define a box class with few conditions. These are as follows −There are three attributes l, b and h for length, breadth and height respectively, (these are private variables)Define one non-parameterized constructor to set l, b, h to 0, and one parameterized constructor to set values initially.Define getter methods for each attributeDefine a function calculateVolume() get the volume of the boxOverload less than operator (

392 Views
Suppose we have one binary array nums, and a value k. In one move, we can select two adjacent indices and swap their values. We have to find the minimum number of moves required so that nums has k consecutive 1's.So, if the input is like nums = [1, 0, 0, 1, 0, 1, 0, 1], k = 3, then the output will be 2 because in one swap we can make array from [1, 0, 0, 1, 0, 1, 0, 1] to [1, 0, 0, 0, 1, 1, 0, 1], then [1, 0, 0, 0, 1, 1, 1, 0].To ... Read More

161 Views
Suppose we have one undirected weighted graph with n nodes using one edgeList, where edgeList[i] has three parameters (u, v, w) denotes there is a path from u to v whose distance is w. We also have another query array where query[i] has (p, q, lim). This query is trying to ask whether there is a path (direct or via some other node) from p to q whose distance is less than lim. We have to return an array holding True/False results for each query.So, if the input is likethen the output will be [True, False, True]. Because to go ... Read More

790 Views
Suppose we have n students score on five subjects. The first scores are for Kamal, and there are n-1 more scores for other students and each student has five subjects. We shall have to count number of students who have scored more than Kamal. Here we shall define one class called students to load scores for each students. The class has one Input() function to take input and calculateTotalScore() function to calculate score of a student from given five marks.So, if the input is like n = 4 scores = [[25, 45, 32, 42, 30], [22, 25, 41, 18, 21], ... Read More

506 Views
Suppose we have an array nums. We can perform two types of operations on any element of the array any number of timesFor even elements, divide it by 2For odd elements, multiply it by 2.Now the deviation of the array is the maximum difference between any two elements in the array. We have to find the minimum deviation the array can have after performing some number of operations. So, if the input is like nums = [6, 3, 7, 22, 5], then the output will be 5 because we can make our array in one operation [6, 6, 7, 22, ... Read More

552 Views
Suppose we want to make student data type with data hiding and encapsulation. Students must have first_name, last_name, age and class items, but these variables cannot be accessible directly. We shall have to define some functions like get_firstname() set_firstname(), get_age() set_age() etc to retrieve and update variable values, and a to_string() function to display students details in this format (age, first_name, last_name, class). From the console take four parameters as input and set them using setter methods that we have defined, and show each items using getter methods and finally using to_string() method.So, if the input is likepriyam kundu 16 ... Read More