## Check if a given string can be formed by two other strings or their permutations

Updated on 15-Mar-2023 10:27:21
A string is a continuous stream of characters, numbers. It may even contain special characters. An string can be composed of multiple sub-strings, also referred by words. A permutation of a string is another string composed of the same set of characters, possibly arranged in a different order. It can basically be considered as a reordering of the string letters. For instance, abcd and badc are the permutations of the same string. Sample Examples Example 1 : str : “Permutation” arr : {“repuio”, ”mat”, “mtatn”, ”mutate”} Output :Yes The input string “Permutation” can be formed from the pair strings at ... Read More

## Modelling the Projectile Motion using Python

Updated on 14-Mar-2023 16:10:15
Let us first understand some basic concepts and equations based on which the projectile motion can be modelled. The figure shown below explains some basic terminologies of projectile motion. Here, "u" is the velocity with which the projectile is being projected. 𝛼 is the angle of projection of the projectile. The path taken up by the projectile during its flight. Range is the maximum horizontal distance travelled by the projectile. $\mathrm{h_{max}}$ is the maximum height attained by the projectile. Moreover, the time taken up by the projectile to travel the range is called as time of flight. The projectile ... Read More

## PHP and Xvfb usage

Updated on 14-Mar-2023 16:14:56
Introduction Xvfb stands for "X Virtual Frame Buffer" which is used to create a virtual display in memory without any attached physical display device. It allows running graphical applications without any actual graphics hardware. PHP is a server-side scripting language widely used for web development. In this article, we will discuss how we can use Xvfb with PHP to run graphical applications in headless mode. Why do we need Xvfb with PHP? PHP is a server-side scripting language and doesn't provide any direct support for graphics and user interfaces. Most of PHP-based web applications are built on top of popular ... Read More

## Run a Qt app in a different language

Updated on 14-Mar-2023 16:12:25
Qt is a cross-platform application framework that is widely used for developing applications with graphical user interfaces. It is written in C++ and supports a range of programming languages, including Python, Ruby, and Java. One of most useful features of Qt is its support for internationalization, which allows developers to create applications that can be easily localized for different languages and cultures. In this article, we will discuss how to run a Qt app in a different language. Introduction to Internationalization Internationalization, also known as i18n, is process of designing and developing applications that can be easily localized for different ... Read More

## Stormer Numbers

Updated on 14-Mar-2023 15:07:04
For N to be a stormer number, the highest prime factor of the expression N^2+1 must be greater than or equal to 2*N and it should be a positive integer. For example, 4 is a stormer number. Since 4*4+1=17 has the greatest prime factor 17 itself which is greater than 8 i.e. 2*4. But 3 is not a stormer number because 3*3+1=10. The greatest prime factor of 10 is 5 which is less than 6 i.e. 2*3. In this problem, we are given a positive integer N and our goal is to print the first N stormer. INPUT: 4 ... Read More

## Print first n Fibonacci Numbers using Direct Formula

Updated on 14-Mar-2023 15:05:24
In this article, we are going to solve the problem of printing first n Fibonacci Numbers using a direct formula. In mathematics, the fibonacci numbers often denoted by Fn (which indicates nth fibonacci number), form a series in which each number is equal to the sum of the preceding two numbers. The nth fibonacci number can be indicates as below − $$\mathrm{Fn\:=\:F_{n-1}\:+\:F_{n-2}}$$ The series begins with 0 and 1. The first few values in the fibonacci sequence, starting with 0 and 1 are − 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144. ... Read More

## Number of Ones in the Smallest repunit

Updated on 14-Mar-2023 15:03:25
In this problem, we simply need to print the number of ones in the smallest repunit. A repunit is a positive number like 11, 111, or 1111 in recreational mathematics that only has the digit 1. A repunit is of the form $\mathrm{(10*n-1)/9}$ Example $\mathrm{(10*10-1)/9}$ gives 11. $\mathrm{(10*100-1)/9}$ gives 111. $\mathrm{(10*1000-1)/9}$ gives 1111. The above problem states that we are given any positive integer N with its unit digit 3 and we need to determine the smallest repunit that is divisible by the given number N. For example, If we are given N=13. Output: 6 N i.e. 13 perfectly divides ... Read More

## Multiply the given number by 2 such that it is divisible by 10

Updated on 14-Mar-2023 14:55:40
This problem statement says that we are allowed to perform only one operation i.e. multiply the given number by 2 such that it is divisible by 10. We will be given a number say n. The only operation that we can perform on a given number is that we can multiply the given number by 2 until it is divisible by 10. We need to determine the minimum number of operations required to make the number such that it is divisible by 10 by repeatedly multiplying the given number n by 2. Else, print -1 if it is not possible ... Read More

## Minimum steps in which N can be obtained using addition or subtraction at every step

Updated on 14-Mar-2023 14:52:03
From the above problem statement, our task is to get the minimum steps in which a given number N can be obtained using addition or subtraction at every step. We can understand that we need to print the minimum number of steps that we can perform and sequence of the steps on any given integer N to reach the number starting from 0 by addition or subtraction of the step number. In this problem set, we can add or subtract the number equal to the step count from the current location at each step. For instance, we can add either ... Read More

## Level order traversal with direction change after every two levels(Implementation in C/C++)

Updated on 20-Mar-2023 16:06:06
Level Order TraversalThis is one of the algorithms that processes or prints all nodes of a binary tree by traversing through depth, starting at the root and moving on to its children and so forth.Example INPUT − OUTPUT − 2 4 7 3 6 11 This task involves printing a binary tree's level order traversal so that the first two levels are printed from right to left direction, and the next two levels from left to right direction, and so on. The challenge is that a binary tree's level order traverse must be ... Read More