Found 7346 Articles for C++

Check if the given String can be split only into subsequences ABC

Prabhdeep Singh
Updated on 16-May-2023 13:28:41

131 Views

A subsequence of a string means part of a string in which characters can be taken from anywhere of the string (zero or more elements) without changing the order of the characters and forming a new string. In this problem, we have given a string of length N where every character of the string belongs to either ‘A’, ‘B’, or ‘C’ character. Our task is to find that the string can be split only into subsequences “ABC” or Not. If the string is split only into subsequences “ABC” then return “yes” otherwise return “no”. Input 1: str = “AABCBC” ... Read More

Check if the Decimal representation of the given Binary String is divisible by K or not

Prabhdeep Singh
Updated on 16-May-2023 12:36:08

296 Views

A binary string is a string that consists of only two different types of characters and that is ‘0’ and ‘1’, hare base is 2. And a decimal representation means each digit is lie between ‘0’ to ‘9’, here the base is 10. Here we have given a string of binary numbers and an integer k. we have to check if the decimal representation of the given binary string is divisible by k or not. If it is divisible then we have to return ‘yes’ otherwise return ‘no’. In the conversion of binary to decimal, we convert a base 2 ... Read More

Maximize the sum of selected numbers from an array to make it empty

Prabhdeep Singh
Updated on 16-May-2023 12:31:26

129 Views

We will be given an array and have to choose an element from it and add that element to the sum. After adding that element to the sum, we have to remove three elements from the array if they exist current number, current number -1, and current number + 1. By this method we will make the array empty and will get a sum. At the end, we have to make the sum maximum. Input: [ 1, 2, 3] Output: 4 Explanation At first, we can have three moves, delete 1, 2, or 3. Let ... Read More

Print all possible joints of a Trie constructed from a given list of string

Tapas Kumar Ghosh
Updated on 15-May-2023 18:02:27

180 Views

In C++, the trie has an advanced data structure that is used for storing the collection of trees. The word tries came from the word retrieval and it is known as a digital tree or prefix tree. Let’s take an example of all possible joint by taking a given list of strings. We are defining the string input as {“tutor”, “true”, “tuo”} We can observe that the different string of characters is connected to the single string of the character. So here t and u are the list of characters in the string that joints all possible strings. In ... Read More

Maximum distance between two points in coordinate plane using Rotating Caliper’s Method

Tapas Kumar Ghosh
Updated on 24-Jul-2023 10:10:32

117 Views

In C++ we have a predefined function sqrt that returns the square root of any number. The Rotating Caliper’s Method is the technique used to solve the algorithmic or computational geometry. Visual Representation of Rotating Caliper’s MethodThe hand rotation shows the real example of a rotating caliper graph, whenever the hand rotates the perpendicular direction is shown. We can also understand this concept by using a polygon shape. In this article, we are going to find the maximum distance of two coordinate points using Rotating Caliper’s Method. Syntax The following syntax used in the program − vector name ... Read More

Which is Better to Learn Machine Learning: C++, Python, or R?

Devang Delvadiya
Updated on 12-May-2023 15:45:48

221 Views

Machine Learning ML is the investigation of PC calculations that learn without being unequivocally modified by people. They accomplish this by ingesting and preparing information, which assists them with recognizing examples and patterns. ML is generally pertinent in healthcare, marketing, medical services, logistics, human resources, energy, protection, e-commerce, manufacturing, art & creativity, finance, transportation, automobile, government & surveillance, insurance, and digital media and entertainment. Huge corporate goliaths like Apple, Google, Microsoft, IBM, and to a greater extent, use ML. In addition to the tech monsters, however little and mid-sized new companies likewise depend on ML. Most tech organizations use AI ... Read More

Longest Common Prefix in Linked List

Sakshi Koshta
Updated on 10-May-2023 16:25:54

282 Views

The longest common prefix problem is a well-known computer science problem that is frequently encountered when working with strings or lists. It entails determining the string or list element with the longest common prefix. When it comes to linked lists, there are several approaches that can be taken. One common approach is to traverse the linked list and compare the characters of each node in the list until a mismatch is found. The longest common prefix up to the point of mismatch is considered. Linked List A linear linked list can be defined as a collection of variable number of ... Read More

Queries To Evaluate The Given Equation In A Range [L,R]

Sakshi Koshta
Updated on 10-May-2023 16:23:51

98 Views

The evaluation of all equation in an interval [L, R] give us a range of values for those variables. Examples of how this may be used include modelling, data analysis, and problem-solving scenarios. In this situation, we define equations variable values for all point in range. Hence can be done by specifying the step size of the range and evaluating the equation for each variable value inside the range. Specifications It may be called a request for information asked to database. Data is extracted using specific commands when certain requirements are met. To acquire, filter, sort, and summarize data from ... Read More

Find Values after N Operations to Remove N Characters of String ‘S’ With Given Constraints

Sakshi Koshta
Updated on 10-May-2023 16:19:14

163 Views

What are the Specifications of Using String? To solve a specific challenge involving the given string S. The string S contains only lowercase English letters, and certain constraints must be followed while removing characters. The given constraints are − There are lowercase English letters in string S. A character can only be deleted if it appears more than once in string. Only characters that appear consecutively can be deleted. The following steps can be used to remove characters from string S − Find all characters that appear more than once as you iterate over string S. Find all of ... Read More

Sum of Indices of Characters Removed to Obtain an Empty String Based On Given Conditions

Sakshi Koshta
Updated on 10-May-2023 16:16:46

75 Views

String manipulation-related concepts like The Sum of indices of Characters deleted to obtain an Empty String are frequently utilized in programming challenges and competitions. The result is then computed using the sum of the eliminated characters' indexes. The Sum of indices of Characters deleted to obtain an Empty String is a practical idea in string manipulation that may be used to solve a variety of programming difficulties and challenges. Problem Approach We must first comprehend the problem statement and given criteria to find total of character indices eliminated to produce empty string. Given string S, the objective is to determine ... Read More

Advertisements