Articles on Trending Technologies

Technical articles with clear explanations and examples

Check if 2 * K + 1 non-empty strings exists whose concatenation forms the given string

Shubham Vora
Shubham Vora
Updated on 18-Aug-2023 187 Views

In this problem, we have given a string, and we need to divide the string into k + 1 substrings such that the concatenation of k + 1 substrings with their reverse can give us the original string. Observation can solve the problem. If the string's first and last k characters are the same, we can say it is possible to create a k + 1 string according to the given condition. Problem statement – We have given a string of length N containing the lowercase alphabetical characters and positive integer K. We need to find whether we can ...

Read More

Minimum Cost to Modify a String

Sonal Meenu Singh
Sonal Meenu Singh
Updated on 18-Aug-2023 467 Views

Introduction In this tutorial, we use C++ programming concepts to implement examples to find the minimum cost to modify a string. String modification includes operations to change one string into another string. String operations include insertion, deletion, and substitution. We predefined the cost of each operation. You can choose the cost values of your choice. Generate output by calculating the total operation cost for string modification. The insertion function is used to insert missing characters, deletion is used to remove unwanted characters, and the substitution operation is used to replace a character with another character. For implementing the above ...

Read More

Maximum Length Palindrome of a String that can be Created with Characters in Range L and R

Sonal Meenu Singh
Sonal Meenu Singh
Updated on 18-Aug-2023 281 Views

Introduction A palindrome is one that reads the same forward and backward. An example of a palindrome string is Mam. In this tutorial, we use C++ programming to find the maximum length palindrome of a string by predefining the range of characters. Our task is to find the largest length of a palindrome string using the input string. We define the range of characters to generate that string. Depending on the situation, L and R can hold any value. Demonstration 1 String = “amem” Range = {1, 4} Output 3 In the above demonstration, the ...

Read More

Longest substring of only 4’s from the first N Characters of the Infinite String

Sonal Meenu Singh
Sonal Meenu Singh
Updated on 18-Aug-2023 212 Views

Introduction In this tutorial, we implement an approach to find the longest substring of only 4 using the first N characters of the infinite string. Infinite string using 4 looks like this: “44444444……” and for this string we define the length of characters to consider for solving the task. To solve the problem of this tutorial, consider an input numerical string, We solve this problem using two conditions and those conditions are as follows: Consider an input string with random digits and generate the longest substring of 4’s from the string. We consider an infinite string of combinations of ...

Read More

Introduction to the Probabilistic Data Structures

Sonal Meenu Singh
Sonal Meenu Singh
Updated on 18-Aug-2023 2K+ Views

Introduction In this tutorial, we will discuss probabilistic data structures in detail. This tutorial will cover the meaning of a Probabilistic Data Structure, its types, and its benefits. When dealing with large data sets or Big Data, basic data structures that use hashtables or HashSets would not be effective enough. As the data size increases, memory requirements increase with limited time for solving a query which restricts the functionality of deterministic basic data structures. Probabilistic data structures are approximate data structures that are collections of data structures. They are called so because they do not provide exact values. They ...

Read More

Given a String and an Integer k, find the kth Substring when all the Substrings are Sorted According to the given Condition

Sonal Meenu Singh
Sonal Meenu Singh
Updated on 18-Aug-2023 307 Views

Introduction In this tutorial, we implement an approach to find the kth substring after sorting all the substrings according to some conditions for a given string and the value of k. The condition to sort the substring is that the substrings are alphabetical while producing the substring in the order of their occurrence of each character in the alphabet. The first alphabet generates all its substrings, then the second alphabet produces all its substrings, and so on. Consider an example: the input string is “abc”, the alphabetically sorted substrings are “a”, “ab”, “abc”, “b”, “bc”, “c”. Predefined the value of ...

Read More

How to Run Specific TestNG Suite with Maven from Command Line?

Ashish Anand
Ashish Anand
Updated on 18-Aug-2023 5K+ Views

TestNG is a testing framework and can use Maven as build tool. It helps to maintain dependencies and their version at one place in pom.xml Maven provides flexibility to run using surefire plugin. If a user has multiple testng.xml files (please note one testng files contains only one test suite), he/she may run the specific suite based on the requirement. Maven provides the flexibility to define suiteXMLFiles as variable and pass the value of variable at run time using command line. In this article we will illustrate how to run specific TestNG suite with maven from command line. Approach/Algorithm to ...

Read More

Mix TestNG and Junit Assertions Together within the Same Test?

Ashish Anand
Ashish Anand
Updated on 18-Aug-2023 402 Views

JUnit and TestNG are the most popular testing frameworks for Java applications. Both frameworks are easy to use. But, they are different with each other. Their import libraries are different so the identifying the code is also different. In this article, we will discuss whether it is possible to mix TestNG and Junit assertions together in same Test. Let’s analyse how these two frameworks work. TestNG When user writes any @Test or other annotations, it needs to import a library as import org.testng.annotations.Test; Here, testng is the key to identify the @Test or any other code execution is based on ...

Read More

How to write a TestNG Listener that can List all Groups of a Test Method?

Ashish Anand
Ashish Anand
Updated on 18-Aug-2023 315 Views

A TestNG class can have different tests like test1, test2, test3 etc. and these tests can be grouped based on different groups like unit, integration or both or any bug number. User may want to run the @Test method based on groups. And, it is always convenient to know which test method belongs to which group so that these details can be included into report. TestNG supports multiple ways to get group name at run time such as injection dependency and Listeners are most popular. Even in Listeners it can be achieved using ITestListener or IInvokedMethodListener. In this article, let’s ...

Read More

Difference between Voltage Drop and Potential Difference

Manish Kumar Saini
Manish Kumar Saini
Updated on 18-Aug-2023 7K+ Views

While analyzing electric circuits, we come across the electrical quantities "voltage drop" and "potential difference" that appear to be the same at first sight because both are measured in Volts. In this article, we will highlight how Voltage Drop is different from Potential Difference in many aspects. Before discussing the differences between Voltage Drop and Potential Difference, let's start with some basics so that it becomes easy to understand the differences between them. What is Voltage Drop? When an electric current flows through a circuit and there is a drop or decrease in the electric potential of the charge ...

Read More
Showing 34521–34530 of 61,297 articles
Advertisements