Pavitra has Published 177 Articles

Python Program for array rotation

Pavitra

Pavitra

Updated on 20-Dec-2019 05:23:17

112 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − Given a text and a pattern, we need to print all occurrences of pattern and its permutations (or anagrams) in text.Now let’s observe the solution in the implementation below −Example Live Demo# maximum value ... Read More

Python Program for Activity Selection Problem

Pavitra

Pavitra

Updated on 20-Dec-2019 05:14:29

763 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement− We are given n activities with their respective starting and finish times. We need to select the maximum number of activities that can be performed by a single person, provided he works on one ... Read More

Python Program for 0-1 Knapsack Problem

Pavitra

Pavitra

Updated on 20-Dec-2019 05:11:38

4K+ Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given weights and values of n items, we need to put these items in a bag of capacity W up to the maximum capacity w. We need to carry a maximum ... Read More

Unit Testing in Python Program using Unittest

Pavitra

Pavitra

Updated on 27-Sep-2019 11:30:13

112 Views

In this article, we will learn about the fundamentals of software testing by the help of unittest module available in Python 3.x. Or earlier. It allows automation, sharing of the setup and exit code for tests, and independent tests for every framework.In unit test, we use a wide variety of ... Read More

Python Program to Print Numbers in an Interval

Pavitra

Pavitra

Updated on 27-Sep-2019 11:06:50

377 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statementGiven the starting and ending range of an interval. We need to print all the numbers in the interval given.A prime number is a natural number greater than 1 that has no positive ... Read More

Python program to print all odd numbers in a range

Pavitra

Pavitra

Updated on 27-Sep-2019 08:05:27

693 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statementGiven a range, we need to print all the odd numbers in the given range.The brute-force approach is discussed below −Here we apply a range-based for loop which provides all the integers available ... Read More

Python program to print all even numbers in a range

Pavitra

Pavitra

Updated on 27-Sep-2019 08:01:48

1K+ Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statementGiven a range, we need to print all the even numbers in the given range.The brute-force approach is discussed below −Here we apply a range-based for loop which provides all the integers available ... Read More

Python Program to find whether a no is the power of two

Pavitra

Pavitra

Updated on 27-Sep-2019 07:56:11

147 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statementGiven a number n, we need to check whether the given number is a power of two.ApproachContinue dividing the input number by two, i.e, = n/2 iteratively.We will check In each iteration, if ... Read More

Python program to find the most occurring character and its count

Pavitra

Pavitra

Updated on 26-Sep-2019 14:31:24

392 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statementGiven an input string we need to find the most occurring character and its count.ApproachCreate a dictionary using Counter method having strings as keys and their frequencies as values.Find the maximum occurrence of ... Read More

Python Program to find the sum of array

Pavitra

Pavitra

Updated on 26-Sep-2019 14:11:29

733 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statementGiven an array as an input, we need to compute the sum of the given array.Here we may follow the brute-force approach i.e. traversing over a list and adding each element to an ... Read More

Previous 1 ... 7 8 9 10 11 ... 18 Next
Advertisements