
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

63 Views
Given the task is to show the working of fma() function in C++. In this article we will look into what parameters this function need and what results it will be returning.fma() is an inbuilt function of cmath header file, which accepts three parameters x, y and z and return the result x*y+z without losing the precision in any intermediate result.Syntaxfloat fma(float x, float y, float z);Ordouble fma(double x, double y, double z); Orlong double fma(long double x, long double y, long double z);Parametersx − The first element to be multiplied.y − The second element with which x is to ... Read More

144 Views
Given is the task to show the functionality of Deque crend( ) function in C++ STLWhat is Deque?Deque is the Double Ended Queues that are the sequence containers which provides the functionality of expansion and contraction on both the ends. A queue data structure allow user to insert data only at the END and delete data from the FRONT. Let’s take the analogy of queues at bus stops where the person can be inserted to a queue from the END only and the person standing in the FRONT is the first to be removed whereas in Double ended queue the ... Read More

184 Views
Given is the task to show the functionality of Deque emplace( ) function in C++ STLWhat is Deque?Deque is the Double Ended Queues that are the sequence containers which provides the functionality of expansion and contraction on both the ends. A queue data structure allow user to insert data only at the END and delete data from the FRONT. Let’s take the analogy of queues at bus stops where the person can be inserted to a queue from the END only and the person standing in the FRONT is the first to be removed whereas in Double ended queue the ... Read More

532 Views
Suppose we have a string S, we have to find the number of substrings of length K where no characters are repeated. So if S = “heyfriendshowareyou” and K is 5, then output will be 15, as the strings are [heyfr, eyfri, yfrie, frien, riend, iends, endsh, ndsho, dshow, showa, howar, oware, warey, areyo, reyou]To solve this, we will follow these steps −create one empty map m, and left := 0 and right := -1 and ans := 0while right < length of string – 1if right – left + 1 = k, thenincrease ans by 1decrease m[str[left]] by 1increase ... Read More

528 Views
Suppose we have N rooms and we start in room 0. In each room there exists a distinct number in 0, 1, 2, ..., N-1, and each room may have some keys to access the next room. So in other words, each room i has a list of keys rooms[i], and each key rooms[i][j] is an integer in [0, 1, ..., N-1] where N = number of rooms. A key rooms[i][j] = v, this opens the room with number v So if the input is [[1], [2], [3], []]. then output will be true. There are few more points that ... Read More

451 Views
Suppose we gave an array arr that is a permutation of [0, 1, ..., arr.length - 1], we have to split the array into some number of "chunks" or partitions, and individually sort each partition. So after concatenating them, the result will be the sorted array. So if the array is like [1, 0, 2, 3, 4], then the output will be 4, as we can split into two partitions like [1, 0] and [2, 3, 4], but this can also be true that [1, 0], [2], [3], [4]. So this is the highest number of chunks possible, so output ... Read More

402 Views
Suppose we have a string S of lowercase letters is given. We will partition this string into as many parts as possible so that each letter appears in at most one part, finally return a list of integers representing the size of these parts. So if the string is like “ababcbacadefegdehijhklij”, output is [9, 7, 8], because the partitions are “ababcbaca”, “defegde”, “hijhklij”. So this is a partition so that each letter occurs in at most one part. A partition like "ababcbacadefegde", "hijhklij" is not correct, because it splits S into less parts.To solve this, we will follow these steps ... Read More

987 Views
Suppose we have a list of daily temperatures T, we have to return a list such that, for each day in the input, shows how many days we would have to wait until a warmer temperature. If there is no future day for which this is possible, store 0 instead. For example, if T = [73, 74, 75, 71, 69, 72, 76, 73], output will be [1, 1, 4, 2, 1, 1, 0, 0].To solve this, we will follow these steps −ans := an array of size same as T, and fill this with 0define one stack, and insert 0 ... Read More

357 Views
Suppose we have given an array of positive integers nums. We have to count and print the number of (contiguous) subarrays where the product of each the elements in the subarray is less than k. So if the input is like [10,5,2,6] and k := 100, then the output will be 8. So the subarrays will be [[10], [5], [2], [6], [10, 5], [5, 2], [2, 6] and [5, 2, 6]]To solve this, we will follow these steps −temp := 1, j := 0 and ans := 0for i in range 0 to size of the arraytemp := temp * nums[i]while temp >= k and j = k && j

446 Views
Suppose we have two words w1 and w2, we have to find the lowest ASCII sum of deleted characters to make w1 and w2 the same, where in each step we can delete one character in either string. So if the input is like “sea” and “eat”, then the output will be 231, because we need to delete ‘s’ from w1, this will be “ea” and delete “t” from “eat” from w2. Then they are same. Deleting ‘t’ from “eat” adds 116 to the sum, and at the end, both strings are the same and 115 + 116 = 231 ... Read More