Found 34494 Articles for Programming

Number of palindromic permutations

Riya Kumari
Updated on 05-Jan-2024 16:08:18

121 Views

Permutations are possible in strings as well as numbers. A string can have permutations equal to the factorial of its number of characters. These permutations can be palindromic under certain circumstances. In this article, we will discuss about how palindromic permutations occur in a string. We will also find the number of palindromic permutations possible in a string using C++. Permutation is a mathematical process of rearranging the letters or characters from a specified string or words. In other words, it is rearrangement of objects or elements in an order. A palindrome is a set of character which are same ... Read More

Number of ordered pairs such that Ai & Aj = 0

Riya Kumari
Updated on 05-Jan-2024 16:04:48

110 Views

Suppose you are given an array and you have to find the total count of ordered pairs formed such that Ai & Aj = 0. You are given an array A[A1, A2, A3, …An]. You have to find ordered pairs of Ai and Aj such that their bitwise AND operation will give the result equal to 0. In other words, you have to count the pairs of elements (i, j) whose bitwise AND operation is zero. For example, we have an array [3, 4, 2]. The binary representation of each element are as follows − A1 = 3 = ... Read More

Number of n digit stepping numbers - space optimized solution

Riya Kumari
Updated on 05-Jan-2024 16:02:29

72 Views

In this article, we will learn about stepping numbers. We will find the possible number of n digit numbers which are also stepping numbers using several C++ techniques. We will also discuss about the most space optimized solution. Let’s first discuss about stepping numbers. These are such numbers which have adjacent digits in such a way that they all have a difference of 1. For example, 321- each of the adjacent digits (3, 2, 1) have a difference of 1 consecutively. Here, we will be given the value of N and then we have to find the count of all ... Read More

Number of n digit numbers that do not contain 9

Riya Kumari
Updated on 05-Jan-2024 16:01:04

91 Views

Suppose you have a given number N. Now, you want to find those numbers of N digit which do not contain 9. This question can be solved by permutation and combination mathematically. In this article, we will find such numbers and count them using C++. Suppose you have to find 1-digit numbers which do not contain 9. So, these numbers are (0 – 8). There are in total 8 such numbers. Similarly, we have to find the count of N digit such numbers. Here, we will be given the value of N and then we have to find the count ... Read More

Number of mismatching bits in the binary representation of two integers

Riya Kumari
Updated on 05-Jan-2024 16:00:02

106 Views

Binary language is the language of the computers. So, every integer, character or symbols needs to be converted into binary system and vice versa. There is binary representation to all high-level language. In this article, we will discuss about the binary representation of integers. Also, we will find the mismatching bits in the binary representation of two integers. Input Output Scenarios We are given two integers X and Y. The number of mismatching bits in their binary representation is the output. Input: X = 25, Y = 15 Output: 3 Input: X = 6, X = 19 Output: 3 ... Read More

Number of matches required to find a winner

Riya Kumari
Updated on 05-Jan-2024 15:59:02

166 Views

Tournaments can be of various types- single elimination, double elimination, league etc., Suppose you are an organizer and you want to know about how many matches needs to conducted in order to conduct the tournament according to the rules of the game. In this article, we will discuss about different ways to find the number of matches required to find a winner using C++. Understanding the Problem In a single elimination tournament, we have series of matches in which each team or player gets to compete with the other one. In each match, there are two teams or players. The ... Read More

How to Convert Bytearray to Hexadecimal String using Python?

Niharika Aitam
Updated on 03-Jan-2024 12:17:36

843 Views

What is Hexadecimal String? A hexadecimal string is a textual representation of data in the hexadecimal number system. In this system the numbers are represented using a base-16 notation which means in the combination of digits 0 to 9 and the letters A to F. Each hexadecimal digit corresponds to a 4-bit binary sequence which allowing compact representation of binary data. In a hexadecimal string each character represents a nibble i.e. 4 bits of data. Two hexadecimal characters together form a byte i.e. 8 bits. Hexadecimal strings are commonly used to represent binary data such as byte sequences, memory addresses, ... Read More

Discuss the effect of changing the plot's aspect ratio on the visual representation of data.

Niharika Aitam
Updated on 03-Jan-2024 12:14:29

47 Views

The aspect ratio of a plot refers to the ratio of the width to the height of the plotting area. It is a crucial parameter in data visualization as it determines the shape and proportions of the plot which directly affects how the data is visually represented. For example in a square plot the aspect ratio would be 1:1 which means the width is equal to the height. In contras if the width is twice the height then the aspect ratio would be 2:1 and the plot would be wider horizontally. The below are the effects of changing the plot’s ... Read More

Python - Consecutive Character Maximum difference

Niharika Aitam
Updated on 03-Jan-2024 12:13:25

48 Views

Consecutive Character Maximum Difference refers to finding the maximum absolute difference between the ASCII values of consecutive characters in a string. It is used to measure the maximum "gap" or "jump" in the character sequence based on their ASCII values. In Python, each character in a string is represented internally as a Unicode code point, and the corresponding ASCII value can be obtained using the `ord()` function. The ASCII values of consecutive characters can be compared to calculate the absolute difference between them. For example, consider the string "abcdefg" − The ASCII value of 'a' is 97. The ASCII ... Read More

Python - Concatenate N consecutive elements in String list

Niharika Aitam
Updated on 03-Jan-2024 12:12:14

75 Views

Concatenation is the process of combining two or more strings, sequences, or data structures together to create a single larger entity. In the context of strings, concatenation involves joining multiple strings end-to-end to form a new, longer string. In many programming languages such as Python, the concatenation operation is typically represented using the + operator. When we use the + operator with strings, it performs string concatenation, joining the strings together in the order they appear. Example Here's an example of string concatenation in Python. string1 = "Welcome to " string2 = "Tutorialspoint!" result = string1 + string2 print(result) ... Read More

Previous 1 ... 5 6 7 8 9 ... 3450 Next
Advertisements