Arnab Chakraborty has Published 4293 Articles

Program to count number of similar substrings for each query in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 06:15:35

368 Views

Suppose we have two strings s and a set of query Q. Where Q[i] contains pair (l, r), for each substring of s from l to r, we have to find number of substrings s from x to y where they are similar. Two strings s and t are similar ... Read More

Program to create a lexically minimal string from two strings in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Oct-2021 11:29:37

160 Views

Suppose, we have two strings. We want to make a lexically minimum string from those strings. To make the string we compare the first letter of the two strings and extract the lexically smaller letter from one of the strings. In the case of a tie i.e, the letters are ... Read More

Program to find out the number of shifts required to sort an array using insertion sort in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 09-Oct-2021 11:07:25

1K+ Views

Suppose we are given an array and asked to perform insertion sort on it. In insertion sort, each element in an array is shifted to its correct position in the array. We have to find out the total number of shifts required to sort an array. The total number of ... Read More

C program to sort triangles based on area

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 11:26:27

820 Views

Suppose we have an array of different triangles where triangles[i] = [ai, bi, ci] these are the sides of ith triangle. We shall have to sort the triangles based on their area. The area of a triangle by using sides is: square root of p*(p-a)*(p-b)*(p-c) where p = (a+b+c)/2.So, if ... Read More

C program to find sum, max and min with Variadic functions

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 11:23:16

2K+ Views

Suppose we want to make some functions that can take multiple arguments, there are no fixed number of arguments. We want to make three functions sum(), max() and min(), they can calculate sum of the numbers, maximum of numbers and minimum of given numbers respectively. Each of these functions will ... Read More

C program to find permutations of given strings

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 11:19:50

6K+ Views

Suppose we have few strings in an array. We shall have to find all permutations of them in different line.So, if the input is like strings = ["abc", "def", "ghi"], then the output will beabc def ghi abc ghi def def abc ghi def ghi abc ghi abc def ghi ... Read More

C program to find frequency of each digit in a string

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 11:18:19

5K+ Views

Suppose we have a string s. The s contains letters and digits both. We shall have to find frequencies of each digit and display them. To do this we can make an array of size 10 for each digits (0 through 9), initially all elements are 0 inside the array, ... Read More

C program to print string tokens

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 11:15:09

3K+ Views

Suppose we have a string s that contains a sentence with few words. We shall have to print each word into new lines. To do this we can use the strtok() function under the string.h header file. This function takes the string and a delimiter. Here the delimiter is blank ... Read More

C program to dynamically make array and print elements sum

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 11:09:20

8K+ Views

Suppose we have a number n. We shall have to make an array of size n dynamically and take n numbers one by one, then find the sum. To make the array we can use malloc() or calloc() function which is present inside the stdlib.h header file. The value of ... Read More

C program to find amount of volume passed through a tunnel

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 11:06:23

391 Views

Suppose there is a tunnel whose height is 41 and width is very large. We also have a list of boxes with length, width and height. A box can pass through the tunnel if its height is exactly less than tunnel height. We shall have to find amount of volume ... Read More

Advertisements