
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

2K+ Views
Suppose we have a date string in the format "Day Month Year" format where day's are like [1st, 2nd, ..., 30th, 31st], months are in [Jan, Feb, ... Nov, Dec] format and year is a four-digit numeric value in range 1900 to 2100, we have to convert this date into "YYYY-MM-DD" format.So, if the input is like date = "23rd Jan 2021", then the output will be 2021-01-23To solve this, we will follow these steps −Months:= ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]string:= split the date and form a list like [day, month, year] formatyear ... Read More

2K+ Views
Suppose we have a list of numbers called nums. We have to check whether the elements present in nums are forming AP series or not. As we know in AP (Arithmetic Progression) series the common difference between any two consecutive elements is the same.So, if the input is like nums = [9, 1, 17, 5, 13], then the output will be True because if we sort them, it will be [1, 5, 9, 13, 17] and here common difference is 4 for each pair of elements.To solve this, we will follow these steps −nums := sort the list numsif number ... Read More

2K+ Views
Suppoe we have an array with distinct elements called salary where salary[i] is the salary of ith employee. We have to find the average salary of employees excluding the minimum and maximum salary.So, if the input is like salary = [8000, 6000, 2000, 8500, 2500, 4000], then the output will be 5125.0, as the minimum and maximum salary values are 2000 and 8500, so excluding them the average salary values are [8000, 6000, 2500, 4000] so the average is (8000 + 6000 + 2500 + 4000)/4 = 5125.To solve this, we will follow these steps −delete minimum of salary from ... Read More

849 Views
Suppose we have an integer n and another integer start. We have to create an array called nums where nums[i] = start + 2*i (i start from 0) and n is the size of nums. Then find the bitwise XOR of all elements of nums.So, if the input is like n = 6, start = 2, then the output will be 14 because the array will be like [2+2*0, 2+2*1, ... 2+2*5] = [2, 4, 6, 8, 10, 12], then XOR of each element present in the array is 14.To solve this, we will follow these steps −count := startwhile ... Read More

4K+ Views
Suppose we have an array nums. The running sum of an array as rs[i] is sum of all elements from nums[0] to nums[i]. Finally return the entire running sum of nums.So, if the input is like nums = [8, 3, 6, 2, 1, 4, 5], then the output will be [8, 11, 17, 19, 20, 24, 29], becausers[0] = nums[0] rs[1] = sum of nums[0..1] = 8 + 3 = 11 rs[2] = sum of nums[0..2] = 8 + 3 + 6 = 17 and so onTo solve this, we will follow these steps −n:= size of numsrs:= [nums[0]]for i ... Read More

1K+ Views
Suppose we have an array called prices where prices[i] represents price of the ith item in a shop. There is a special offer going on, if we buy the ith item, then we will get a discount equivalent to prices[j] where j is the minimum index such that j > i and price of jth item is less or same as price of ith item (i.e. prices[j] = prices[j], thenprices[i] := prices[i] - prices[j]come out from the loopotherwise, j := j + 1return pricesExample (Python)Let us see the following implementation to get better understanding − Live Demodef solve(prices): for i ... Read More

304 Views
Suppose we are given a linked list that has the start node as "head", and two integer numbers m and n. We have to traverse the list and delete some nodes such as the first m nodes are kept in the list and the next n nodes after the first m nodes are deleted. We perform this until we encounter the end of the linked list. We start from the head node, and the modified linked list is to be returned.The linked list structure is given to us as −Node value : next : So, if the ... Read More

7K+ Views
To show multiple images in one figure in matplotlib, we can take the following steps −Create random data using numpy.Add a subplot to the current figure, nrows=1, ncols=4 and at index=1.Display data as an image, i.e., on a 2D regular raster, using imshow() method with cmap="Blues_r".Add a subplot to the current figure, nrows=1, ncols=4 and at index=2.Display data as an image, i.e., on a 2D regular raster, using imshow() method with cmap="Accent_r".Add a subplot to the current figure, nrows=1, ncols=4 and at index=3.Display data as an image, i.e., on a 2D regular raster, using imshow() method with cmap="terrain_r".Add a subplot to the current figure, nrows=1, ... Read More

10K+ Views
To remove gaps between bars, we can change the align value to center in the argument of bar() method.StepsCreate a dictionary called data with two keys, milk and water.Get the list of keys and values in the dictionay.Using subplots() method, create a figure and add a set of two subplots.On axis 2, use bar method to plot bars without gaps. Set the width attribute as 1.0. Set the title using set_title() method.Use tight_layout() to adjust the padding between and around the subplots.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True data = {'milk': 12, 'water': ... Read More

2K+ Views
To set theta=0 on a matplotlib polar plot, we can take the following steps −Create random theta in the range of 0 to 100; convert them into radian.Using set_theta_zero_location() method, we can set the location of theta to 0.Plot theta_in_rad and data_r using plot() method.Set the title of the plot using title() method.To display the figure, use show() method.Exampleimport numpy as np import matplotlib.pyplot as plt import random plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True theta_in_rad = [float(i) * np.pi / 180.0 for i in range(0, 100, 10)] data_r = random.sample(range(70, 90), 10) ax = plt.subplot(111, polar=True) ax.set_theta_zero_location("W") ax.plot(theta_in_rad, data_r, color='r', linewidth=3) ax.set_title("Example", ... Read More