
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 10476 Articles for Python

224 Views
Suppose we are given a graph and are asked to find out the minimum size of the largest clique in the graph. A clique of a graph is a subset of a graph where every pair of vertices are adjacent, i.e. there exists an edge between every pair of vertices. Finding the largest clique in a graph is not possible in polynomial time, so given the number of nodes and edges of a small graph we shall have to find out the largest clique in it.So, if the input is like nodes = 4, edges =4; then the output will ... Read More

725 Views
Suppose we have an array called nums, we have to find the number of good ways to split this array nums. Answer may be too large so return result modulo 10^9 + 7. Here a split of an array (with integer elements) is good if the array is split into three non-empty contiguous subarrays respectively from left to right, and the sum of the elements in left side is less than or equal to the sum of the elements in mid part, and the sum of the elements in mid part is less than or equal to the sum of ... Read More

2K+ Views
Suppose we are given a graph and asked to find out the 'Minimum Spanning Tree' (MST) from that graph. An MST of a graph is a subset of a weighted graph where all the vertices are present and connected, and there exists no cycle in the subset. MST is called minimum because the total edge weight of the MST is the minimum possible from the graph. So, here we use Prim's MST algorithm and find out the total edge weight of the MST from a given graph.So, if the input is like, number of vertices (n) is 4, and start ... Read More

979 Views
Suppose we are playing a game of snakes and ladders. We have a condition that we can roll any number that we can like on a dice. We start from position 0 and our destination is position 100, and we roll the dice several times to reach the destination. We must find out the least number of dice rolls required to reach the destination if we are provided with the position of the snakes and ladders on the board.The arrays snakes and ladders represent the positions of snakes and ladders in the board and each entry in the arrays contains ... Read More

291 Views
Suppose we have an array deli where deli[i] is the deliciousness of the ith food, we have to find the number of different good meals we can make from this list. If the answer is too large, then return result modulo 10^9 + 7. Here a good meal means a meal that contains exactly two different food items with a sum of deliciousness which is a power of two. We can select any two different foods to make a good meal.So, if the input is like deli = [1, 7, 3, 6, 5], then the output will be 3 because ... Read More

359 Views
Suppose we have two arrays called days and apples of same length n. There is a special kind of apple tree that grows apples every day for n consecutive days. On the ith day, it grows apples[i] number of apples and that will rot after days[i] days, so we can say it like that on day i + days[i] the apples will be rotten and cannot be eaten. On some days. If apples[i] = 0, and days[i] = 0, then it indicates on day i, the apple tree is not growing any apple. We can take at most one apple ... Read More

167 Views
Suppose we have a positive integer N, we reorder the digits in any order (including the original order) such that the leading digit is non-zero. We have to check whether we can do this in a way such that the resulting number is a power of 2.So, if the input is like N = 812, then the output will be TrueTo solve this, we will follow these steps −i:= 1while i

453 Views
Suppose we have a binary string. We can apply each of the following operations any number of times −If the number contains a substring "00", we can replace it with "10".If the number contains a substring "10", we can replace it with "01".Then we have to find the maximum binary (based on its numeric value) string we can get after any number of operations.So, if the input is like s = "001100", then the output will be 111011, because we can transfer them like (00)1100 -> 101(10)0 -> 1010(10) -> 10(10)01 -> 100(10)1 -> 1(00)011 -> 111011.To solve this, we ... Read More

204 Views
Suppose we have a list of classes where classes[i] represents [pass_i, total_i] represents the number of students passed the examination of ith class and total number of students of the ith class respectively. We also have another value extra. This indicates extra number of brilliant students that are guaranteed to pass the exam of any class they are assigned to. We have to assign each of the extra students to a class in a way that maximizes the average number of passed student across all the classes. The pass ratio of a class determined by the number of students of ... Read More

798 Views
Suppose we have an array customers, where customers[i] = holds a pair [arrival_i, time_i], here arrival_i is the arrival time of the ith customer. And the arrival times are sorted from less to high. And time_i is the time needed to prepare the order of the ith customer. Now, when a customer arrives, he/she gives the order, and the only that order starts preparing when the cook is idle. The cook does not prepare food for more than one customer at a time. And he prepares in order they were placed their orders. We have to find the average waiting ... Read More