Pavitra has Published 145 Articles

Python program to find uncommon words from two Strings

Pavitra

Pavitra

Updated on 20-Dec-2019 07:31:43

682 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given two strings, we need to get the uncommon words from the given strings.Now let’s observe the solution in the implementation below −Example Live Demo# uncommon words def find(A, B):    # ... Read More

Python program to find number of local variables in a function

Pavitra

Pavitra

Updated on 20-Dec-2019 07:29:18

932 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a function, we need to display the number of local variables in the function.Now let’s observe the solution in the implementation below −Example Live Demo# checking locals def scope():    a ... Read More

Python Program to Count trailing zeroes in factorial of a number

Pavitra

Pavitra

Updated on 20-Dec-2019 07:24:23

822 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given an integer n, we need to count the number of trailing zeros in the factorial.Now let’s observe the solution in the implementation below −Example Live Demo# trailing zero def find(n):   ... Read More

Python Program to Count set bits in an integer

Pavitra

Pavitra

Updated on 20-Dec-2019 07:22:44

446 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given an integer n, we need to count the number of 1’s in the binary representation of the numberNow let’s observe the solution in the implementation below −#naive approachExample Live Demo# count ... Read More

Python Program to Count number of binary strings without consecutive 1’

Pavitra

Pavitra

Updated on 20-Dec-2019 07:20:06

283 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a positive integer N, we need to count all possible distinct binary strings available with length N such that no consecutive 1’s exist in the string.Now let’s observe the solution ... Read More

Python Program to Count Inversions in an array

Pavitra

Pavitra

Updated on 20-Dec-2019 07:17:40

259 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a list, we need to count the inversion required and display it.Inversion count is obtained by counting how many steps are needed for the array to be sorted.Now let’s observe ... Read More

Python Program for Triangular Matchstick Number

Pavitra

Pavitra

Updated on 20-Dec-2019 07:15:18

153 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a number X which represents the floor of a matchstick pyramid, we need to display the total number of matchstick required to form a pyramid of matchsticks with x floors.Now ... Read More

Python Program for Tower of Hanoi

Pavitra

Pavitra

Updated on 20-Dec-2019 07:04:37

2K+ Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given n disks and a series of rods, we need to transfer all the disks to the final rod under the given constraints−We can move only one disk at a time.Only the ... Read More

Python Program for Subset Sum Problem

Pavitra

Pavitra

Updated on 20-Dec-2019 06:59:44

2K+ Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a set of non-negative integers in an array, and a value sum, we need to determine if there exists a subset of the given set with a sum equal to ... Read More

Python Program for Stooge Sort

Pavitra

Pavitra

Updated on 20-Dec-2019 06:55:01

225 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given an array, we need to sort it using stooge sort.Algorithm1. Check if value at index 0 is greater than value at last index, then swap them. 2. sort the initial ... Read More

Previous 1 ... 3 4 5 6 7 ... 15 Next
Advertisements