Ankith Reddy

Ankith Reddy

730 Articles Published

Articles by Ankith Reddy

Page 46 of 73

Minimum number of squares whose sum equals to given number

Ankith Reddy
Ankith Reddy
Updated on 17-Jun-2020 750 Views

Any numbers can be represented by the sum of some perfect square numbers. In this problem, we need to find that how many minimum numbers of perfect square terms are needed to represent the given value.let the value is 94, so 95 = 92 + 32 + 22 + 12. so the answer will be 4The idea is to start from 1, we move further to get perfect squared numbers. When the value is 1 to 3, they must be formed with only 1s.Input and OutputInput: An integer number. Say 63. Output: Number of squared terms. Here the answer is ...

Read More

Friend Pairing Problem

Ankith Reddy
Ankith Reddy
Updated on 17-Jun-2020 841 Views

In a group, there is n number of friends. Each person can remain single or be paired with some other friend. Find the total number of ways, in which friends can remain single or can be paired up.If one pair has two friends’ p and q, then (p, q) or (q, p) are same. For a group of n friends, let f(n) be the number of ways how they can be paired up or remain single. Then either the nth person remains single, or paired up. If the nth person is single, then we recur for (n - 1) friends. If ...

Read More

Longest Palindromic Subsequence

Ankith Reddy
Ankith Reddy
Updated on 17-Jun-2020 2K+ Views

Longest Palindromic Subsequence is the subsequence of a given sequence, and the subsequence is a palindrome.In this problem, one sequence of characters is given, we have to find the longest length of a palindromic subsequence.To solve this problem, we can use the recursive formula, If L (0, n-1) is used to store a length of longest palindromic subsequence, thenL (0, n-1) := L (1, n-2) + 2 (When 0'th and (n-1)'th characters are same).Input and OutputInput: A string with different letters or symbols. Say the input is “ABCDEEAB” Output: The longest length of the largest palindromic subsequence. Here it is ...

Read More

Longest Bitonic Subsequence

Ankith Reddy
Ankith Reddy
Updated on 16-Jun-2020 589 Views

A sequence is said to be bitonic if it is first increasing and then decreasing. In this problem, an array of all positive integers is given. We have to find a subsequence which is increasing first and then decreasing.To solve this problem, we will define two subsequences, they are the Longest Increasing Subsequence and the Longest Decreasing Subsequence. The LIS array will hold the length of increasing subsequence ending with array[i]. The LDS array will store the length of decreasing subsequence starting from array[i]. Using these two arrays, we can get the length of longest bitonic subsequence.Input and OutputInput: A ...

Read More

Edit Distance

Ankith Reddy
Ankith Reddy
Updated on 16-Jun-2020 3K+ Views

There are two strings given. The first string is the source string and the second string is the target string. In this program, we have to find how many possible edits are needed to convert first string to the second string. The edit of strings can be either Insert some elements, delete something from the first string or modify something to convert into the second string.Input and OutputInput: Two strings to compare. string 1: Programming string 2: Programs Output: Enter the initial string: Programming Enter the final string: Programs The number of changes required to convert Programming to Programs is 4AlgorithmeditCount(initStr, ...

Read More

Tabs With Dropdown Bootstrap Example

Ankith Reddy
Ankith Reddy
Updated on 12-Jun-2020 1K+ Views

To create tabs with Bootstrap, use the .nav and .nav-tabs classes. With that use the .dropdown-menu class. Start with a basic unordered list with the base class of .nav Add the class .nav-tabs. Now add an unordered list with a .dropdown-menu class. You can try to run the following code to create tabs with drop-down − Example        Bootstrap Example                          Website            Home       About                           Products                                        Online Compiler           Image Editor           Document Viewer                       Services       Contact        

Read More

Bootstrap File Structure

Ankith Reddy
Ankith Reddy
Updated on 12-Jun-2020 3K+ Views

The file structure of Bootstrap includes:Precompiled BootstrapOnce the compiled version Bootstrap is downloaded, extract the ZIP file, and you will see the following file/directory structure −Bootstrap Source CodeBootstrap source code has the following source code −

Read More

Bootstrap package consists of what all components?

Ankith Reddy
Ankith Reddy
Updated on 12-Jun-2020 957 Views

A Bootstrap package includes the following,Components − Bootstrap contains over a dozen reusable components built to provide iconography, dropdowns, navigation, alerts, pop-overs, and much more.Scaffolding − Bootstrap provides a basic structure with Grid System, link styles, and background.Customize − Customize Bootstrap's components, fewer variables, and jQuery plugins to get your very own version.CSS − Bootstrap comes with the feature of global CSS settings, fundamental HTML elements styled and enhanced with extensible classes, and an advanced grid system.JavaScript Plugins − Bootstrap contains over a dozen custom jQuery plugins. You can easily include them all, or one by one.

Read More

How to generate pyramid of numbers using Python?

Ankith Reddy
Ankith Reddy
Updated on 05-Mar-2020 976 Views

There are multiple variations of generating pyramids using numbers in Python. Let's look at the 2 simplest formsExamplefor i in range(5):    for j in range(i + 1):       print(j + 1, end="")    print("")OutputThis will give the output1 12 123 1234 12345ExampleYou can also print numbers continuously usingstart = 1 for i in range(5):    for j in range(i + 1):       print(start, end=" ")       start += 1 print("")OutputThis will give the output1 2 3 4 5 6 7 8 9 10 11 12 13 14 15ExampleYou can also print these numbers in reverse usingstart = 15 for i in range(5):    for j in range(i + 1):    print(start, end=" ")    start -= 1 print("")OutputThis will give the output15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

Read More

How to Display the multiplication Table using Python?

Ankith Reddy
Ankith Reddy
Updated on 05-Mar-2020 473 Views

You can create the multiplication table for any number using a simple loop. exampledef print_mul_table(num):    for i in range(1, 11):       print("{:d} X {:d} = {:d}".format(num, i, num * i)) print_mul_table(5)OutputThis will give the output5 X 1 = 5 5 X 2 = 10 5 X 3 = 15 5 X 4 = 20 5 X 5 = 25 5 X 6 = 30 5 X 7 = 35 5 X 8 = 40 5 X 9 = 45 5 X 10 = 50

Read More
Showing 451–460 of 730 articles
« Prev 1 44 45 46 47 48 73 Next »
Advertisements