Vaishnavi Tripathi

Vaishnavi Tripathi

24 Articles Published

Articles by Vaishnavi Tripathi

Page 3 of 3

Undulating Numbers

Vaishnavi Tripathi
Vaishnavi Tripathi
Updated on 11-Apr-2023 366 Views

In this article, we will learn what an undulating number is and our approaches to check whether a given number is undulating or not using a boolean function to check undulating numbers. Problem statement We will be given a number and our task is to check whether the given number is undulating. Let us first learn about an undulating number; An undulating number is a number that only consists of two types of digits and every second digit is the same. We can say an undulating number is of the form “PQPQPQ” where P and Q are two different digits ...

Read More

Smallest triangular number larger than p

Vaishnavi Tripathi
Vaishnavi Tripathi
Updated on 11-Apr-2023 421 Views

We will discuss triangular numbers and how we can find the smallest triangular number just larger than a given number “num”. We will first discuss what exactly is a triangular number and then will find out the smallest triangular number just larger than “num” We will see two different approaches for the same. In the first approach, we will run a simple loop to generate the output, while in our second approach, we will first generate a general formula for calculating the desired number and then will directly apply that formula to get the smallest triangular number. Problem Statement We ...

Read More

Pandigital Product

Vaishnavi Tripathi
Vaishnavi Tripathi
Updated on 11-Apr-2023 447 Views

We are given two numbers and our task is to find out whether the given number is obtained by multiplying two other numbers such that all three numbers together constitute a 9-digit pandigital number. In other words, it can be said that we have to find out whether the given number is pandigital after combining it with two other numbers which result in the original number on multiplication. We can have many such cases where we will get multiple solutions for this problem, to get the best time complexity, we will simply print the first ever solution found and stop ...

Read More

Minimum Adjacent Swaps Required to Sort the given Binary Array

Vaishnavi Tripathi
Vaishnavi Tripathi
Updated on 11-Apr-2023 1K+ Views

There are different approaches, we can use to minimize the number of swaps required on adjacent elements to get a sorted array. The given array as the output only contains two types of elements i.e., 0 and 1. We will discuss two different approaches to solve the problem in which the first solution uses extra space to store the number of zeroes, while the second one uses only constant space. Problem Statement We are given an array which contains only two types of elements 0 & 1. Our aim is to find out how many minimum swaps on adjacent elements ...

Read More
Showing 21–24 of 24 articles
« Prev 1 2 3 Next »
Advertisements