Arnab Chakraborty has Published 4173 Articles

C program to find sum and difference of two numbers

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 10:50:57

6K+ Views

Suppose we have two integer numbers a, b and two floating point numbers c, d. We shall have to find the sum of a and b as well as c and d. We also have to find the sum of a and c as well. So depending on the printf ... Read More

C Program to read and write character string and sentence

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 10:48:36

25K+ Views

Suppose you want to take a character, then a string and a sentence (string with spaces) using C. So we shall provide three inputs and print the same as output. The maximum size of the string is 500 here.So, if the input is likecharacter = 'T' string = "ProgrammingLanguage" sentence ... Read More

Program to find largest color value in a directed graph in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 08:46:08

366 Views

Suppose we have a directed graph with n colored nodes and m different edges. And the nodes are numbered from 0 to n-1. We have a string col with lowercase letters, where col[i] represents the color of the ith node in this graph (0-indexed). We also have an edge list ... Read More

Program to find minimum interval to include each query in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 08:42:27

426 Views

Suppose we have a list of intervals, where intervals[i] has a pair (left_i, right_i) represents the ith interval starting at left_i and ending at right_i (both inclusive). We also have another array called queries. The answer to the jth query is the size of the smallest interval i such that ... Read More

Program to find closest room from queries in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 08:31:02

249 Views

Suppose there is an array called rooms. where rooms[i] contains a pair [roomId_i, size_i] denotes a room whose id is roomId_i and size is size_i. All room numbers are distinct. We also have another array queries, where queries[j] contains a pair [preferred_j, minSize_j]. The answer to the jth query is ... Read More

Program to find maximum building height in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 08:27:50

905 Views

Suppose we have a value n and another list of pairs called restrictions. We want to build n new buildings in a city. But there are few restrictions. We can built in a line and buildings are labeled from 1 to n. The restrictions has two parameters, so restrictions[i] = ... Read More

Program to find XOR sum of all pairs bitwise AND in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 08:24:37

2K+ Views

Suppose we have two arrays arr1 and arr2. The XOR sum of a list is the bitwise XOR of all of its elements. If the list has only one element, then its XOR sum will be the element itself. Now, consider the list has the result of arr1[i] AND arr2[j] ... Read More

Program to find minimum number of operations to make string sorted in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 08:19:25

497 Views

Suppose we have a string s. We have to perform the following operation on s until we get a sorted string −Select largest index i such that 1

Program to find number of different subsequences GCDs in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 08:08:56

244 Views

Suppose we have an array nums with positive values. We have to find the number of different GCDs among all non-empty subsequences of nums. As we know the GCD of a sequence of numbers is the greatest value that divides all the numbers in the sequence evenly.So, if the input ... Read More

Program to find maximum number of groups getting fresh donuts in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 07:58:58

192 Views

Suppose we have a value batchSize and an array group where groups[i] denotes that there is a group of groups[i] customers that will visit the shop. So there is a donuts shop that bakes donuts in batches of given batchSize. But they have one rule, they must serve all of ... Read More

Advertisements