Find Number of Digits in Any Base for Decimal Number

Rinish Patidar
Updated on 28-Aug-2023 15:25:51

358 Views

The problem statement includes finding the number of digits in N when represented in any base b numeral system. Initially, N is given in the base−10 numeral system. In the problem, we will be provided with a positive integer N in the input which will be in the base−10 numeral system and a positive integer b greater than 1. Our task will be to find the number of digits when N is being represented in the base−b numeral system. Any number represented in any base number, every digit from right represents the number of times power of that base number ... Read More

Count Numbers Formed by Given Two Digits with Sum Having Given Digits

Rinish Patidar
Updated on 28-Aug-2023 15:23:19

181 Views

The problem statement includes counting the numbers formed by the given two digits, x and y of size N with sum having given digits only i.e. x and y. We need to count the distinct numbers which can be formed by the digits, x and y which will be the user input of size N where N ranges from 1 to 10^6. The N will also be provided in the input. The numbers formed using the digits, x and y of size N must be such that the sum of digits of the numbers formed should have only digits ... Read More

Finding Maximum and Minimum in a Python Set

Dr Ruqaiya Khanam
Updated on 28-Aug-2023 14:45:55

9K+ Views

In this article, the user will see how to calculate the maximum and minimum in a set using Python language. The main feature of the python set is that it contains no duplicates elements, store the elements in unordered form and is also difficult to alter the elements presented in the set. In this article, three different methods are illustrated that is Converting the set to a list, using built-in functions, and using the sorted() function. The ‘sorted()’ function retrieves a set’s element in a sorted way. Approach 1: Finding the maximum and minimum in a Python set ... Read More

Find Volume, Surface Area and Space Diagonal of a Cuboid in Python

Dr Ruqaiya Khanam
Updated on 28-Aug-2023 14:44:16

4K+ Views

In this article, we will discuss how to compute the volume, surface area, and space diagonal of a cuboid. A Cuboid is a 3D geometric shape that resembles a rectangular box. It is also called a rectangular prism. A cuboid has six rectangular faces with twelve edges. The length, breadth, and height of a cuboid are different, but in the case of a cube, all sides are equal. Two examples are illustrated in this article. The first example uses the concept of a user-defined function and the second example uses the parameterized constructor of a defined class to calculate the ... Read More

Get All Possible Slices of a String for K Number of Slices in Python

Dr Ruqaiya Khanam
Updated on 28-Aug-2023 14:34:08

120 Views

In this article, the user will understand how to get all possible slices of a string for K number of slices in a Python program. Two different examples are depicted in this article. We will employ an iteration approach to accomplish the desired result. In the second example, we will utilize the itertools.combinations approach to obtain the sliced string. Let's take an example to demonstrate the computation. The following examples are provided for understanding purposes, and we will go through the computation process one by one. Example 1: Finding all possible slices of a string for K number of slices ... Read More

Make Density Plot in Python with Altair

Dr Ruqaiya Khanam
Updated on 28-Aug-2023 14:25:02

351 Views

Altair is a kind of statistical visualization library in Python. This library is based on vega and vega-lite javascript libraries. Moreover, we can visualize the data distribution in the form of a density plot in Python. These plots are useful whether we need to compare the variable distribution across the different groups or we need to visualize the distribution shape. The useful applications of density plots such as visualizing data shape, outlier detection, comparing distribution and model selection. The density plot is demonstrated in this article with the help of Python code. For better understanding, we are considering an example ... Read More

Generate One-Time Password (OTP) in Python

Dr Ruqaiya Khanam
Updated on 28-Aug-2023 14:21:42

5K+ Views

In this article, we will discuss how to generate a random one-time password (OTP). We will be using two modules in Python, namely the random and string modules, to accomplish this task. The random module provides relevant functions for generating random numbers, while the string module consists of numerous appropriate string constants. This application can be used for secure authentication or temporary access codes, catering to various aspects and requirements. We will present a few examples to illustrate the different approaches in which these programs can be applied. Let's take an example to demonstrate the computation. The following examples are ... Read More

Find XOR of Array Elements Divisible by Given Number in Python

Dr Ruqaiya Khanam
Updated on 28-Aug-2023 14:16:51

309 Views

In this article, we will discuss how to compute the XOR of array elements that are divisible by a given number. The XOR (exclusive OR) is a binary operation that compares the bits of two operands. If the bits are different then it will return 1 whereas it returns 0 if the bits are the same. In this approach, we will use the property of XOR and apply this to this problem. The solution to this problem is shown with a relevant example. Let’s take an example to demonstrate the computation. Consider a simple example for understanding purposes, the array ... Read More

Find Jumbo GCD Subarray in Python

Dr Ruqaiya Khanam
Updated on 28-Aug-2023 14:12:05

140 Views

Jumbo GCD can be referred to find the Greatest Common Divisor (GCD) of a subarray with the maximum length of an array. The GCD is a set of positive integer numbers that divides all the numbers without having a remainder. We can find out the jumbo GCD subarray using two different approaches such as Brute force and Optimized approach using prefix sums. The solution of the jumbo GCD subarray is demonstrated in this article with relevant examples. The Brute force approach can be used to check all possible subarrays of the considering array and to calculate the GCD of an ... Read More

Look Up First Non-Zero Value and Return Corresponding Column Header in Excel

Namita Aggarwal
Updated on 28-Aug-2023 14:02:14

7K+ Views

In this article, users would easily look up the first non-zero value in a row and obtain the corresponding column header. One example is showcased in this article that facilitates efficient solutions for working with data in Excel. By using the combination of the INDEX and MATCH functions in Excel, the provided formula allows the user to determine the column header associated with the first non-zero value in a specific row. By adjusting the ranges to match the data, the user can apply this formula across multiple rows or ranges, helping the user to analyze and process data based on ... Read More

Advertisements