Found 27104 Articles for Server Side Programming

Check if a String is Present in the given Linked List as a Subsequence

Shubham Vora
Updated on 14-Aug-2023 12:46:30

146 Views

In this problem, we will check if the linked list contains the string as a subsequence. We can iterate the list and string together to check whether a string is present as a subsequence in the linked list. Problem statement − We have given a string of size N. Also, we have given a linked list of the dynamic length containing the alphabetical characters. We need to check whether the linked list contains the string as a subsequence. Sample examples Input 'e' -> 'h' -> 'e' -> 'k' -> 'h' -> 'e' -> 'l' ->'o' -> 'l' -> 'o' ... Read More

C++ Program for Generating Lyndon Words of Length n

Shubham Vora
Updated on 14-Aug-2023 12:42:40

53 Views

In this problem, we need to generate the Lyndon words of the length n using the given characters. The Lyndon words are words such that any of its rotations is strictly larger than itself in the lexicographical order. Here are examples of Lyndon words. 01 − The rotations of ‘01’ is ‘10’, which is always strictly greater than ‘01’. 012 − The rotations of ‘012’ is ‘120’ and ‘210’, which is strictly greater than ‘012’. Problem statement − We have given an array s[] containing numeric characters. Also, we have given n representing the length ... Read More

Filter key from Nested item using Python

Tapas Kumar Ghosh
Updated on 14-Aug-2023 12:36:01

526 Views

Python can extract a specific value from a complex data structure that has nested dictionaries or lists by filtering a key from a nested item. The key is a unique identifier for a certain value inside the nested item. Based on this problem statement it has various application domains such as data manipulation, data interaction, and, API interaction. Syntax The following syntax is used in the examples- append() This is a built−in method in Python that adds the element at the end of the list. isintance() Python has a built−in function called isinstance() that determines whether an object ... Read More

Python - Find Minimum Pair Sum in list

Tapas Kumar Ghosh
Updated on 14-Aug-2023 12:34:34

295 Views

The Minimum pair sum is defined by finding the smallest possible sum of two numbers taken from a given list of numbers. It can be used to solve challenges when minimizing the total of two elements is important, such as reducing the cost, distance, or time necessary for a certain operation. In Python, we have some built−in functions like float(), sort(), combination(), and, range() will be used to find the minimum pair sum in a list. Syntax The following syntax is used in the examples- float('inf') The float() is a built−in method in Python that accepts the parameter to ... Read More

Python - Find Index Containing String in List

Tapas Kumar Ghosh
Updated on 16-Aug-2023 10:41:50

1K+ Views

Sometimes working with Python string, we may come across a real-world scenario where it can be useful for text parsing, pattern matching, and extracting specific information from text data. In Python, we have some built-in functions such as type(), index(), append(), and, isinstance() will be used to find the index containing String in List. Let’s take an example of this: The given input string, my_list = [108, 'Safari', 'Skybags', 20, 60, 'Aristocrat', 78, 'Raj'] Output 1, 2, 5, 7 Explanation The variable name my_list stores the input list that contains the mixing of integer and string in ... Read More

Find the Index of Maximum Item in a List using Python

Tapas Kumar Ghosh
Updated on 14-Aug-2023 12:29:42

10K+ Views

In Python, the index of maximum item refers to a specific index in which the item will be greater than all the elements of the list. In Python, we have some built−in functions len(), max(), series(), idxmax(), and index() that can be used to find the index of maximum item in a list. Let’s take an example of this. The given string, [61, 12, 4, 5, 89, 7] So, the maximum present index becomes 4 i.e. 89. Syntax The following syntax is used in the examples- len() The len() is a built−in method in Python that returns the object ... Read More

Python - Inter Matrix Grouping

Tapas Kumar Ghosh
Updated on 14-Aug-2023 12:22:26

71 Views

The Inter Matrix Grouping is the set of two different lists where the sublist of first element will be considered to be common matches and if the matches are found it makes the first element as key in the dictionary, and the rest two elements are set for matrix grouping. In Python, we have some built−in functions such as setdefault(), defaultdict(), and, append() will be used to solve the Inter Matrix Grouping. Let’s take an example of this. The given two lists are: list_1 = [[1, 2], [3, 4], [4, 5], [5, 6]] list_2 = [[5, 60], [1, 22], [4, ... Read More

How to Iterate through a List without using the Increment Variable in Python

Tapas Kumar Ghosh
Updated on 14-Aug-2023 12:18:22

143 Views

The iteration is a simple programming algorithm to take some steps to iterate all the elements present in a list. The main feature of iteration is to repeat the code of block multiple times. In Python, we have some built−in functions such as enumerate(), list(), map(), and, lambda will be used to iterate through a list without using the increment variable. Syntax The following syntax is used in the examples enumerate() The enumerate() is an in−built function in Python that can be used to track the specific iteration. list() The list() is a built−in method in Python that ... Read More

How to Initialize an Empty Array of given Length using Python

Tapas Kumar Ghosh
Updated on 14-Aug-2023 12:15:07

9K+ Views

An empty array consists of either a null value or no element. The empty array is very special to programming when the programmer uses the condition to perform specific tasks. In Python, we have some built−in functions such as empty(), append(), range(), and, extend() will be used to Initialize an empty array of the given length. Syntax The following syntax is used in the examples empty() The empty() is an in−built function in Python that returns the new array in the form of given length and type. append() The append() is an in−built function in Python that inserts ... Read More

Initialize a Dictionary with Custom Value list in Python

Tapas Kumar Ghosh
Updated on 14-Aug-2023 12:13:24

170 Views

The dictionary is defined by storing the key with value pair whereas a custom value list in the dictionary means the list connected with all the key elements can be modified or changeable according to conditions. This gives an efficient approach to a program that users can add, modify, or remove within a list to require fulfillment. In Python, we have some built−in functions− range(), len(), zip(), dict(), and, enumerate() will Initialize a dictionary with custom value list. Syntax The following syntax is used in the examples- range() The built−in function range() is defined by returning the sequence of ... Read More

Advertisements