Java Articles

Page 207 of 450

Fibonomial coefficient and Fibonomial triangle

Vaishnavi Tripathi
Vaishnavi Tripathi
Updated on 09-Feb-2024 213 Views

In this article, we will discuss about a special type of number called fibonomial coefficient and how does a fibonomial triangle looks like. We will also discuss the C++ code approach to print a fibonomial triangle with a given height. Let us first discuss that what is a fibonomial coefficient. Fibonomial Coefficient We can call a fibonomial coefficient a generalisation of well known terms namely , Fibonacci numbers and binomial coefficients. The Fibonacci numbers are a series of numbers in which, each number is the sum of the two preceding numbers (for example − 0, 1, 1, 2, 3, 5, ...

Read More

Code Solution to sword puzzle

Vaishnavi Tripathi
Vaishnavi Tripathi
Updated on 09-Feb-2024 534 Views

We will discuss two approaches to solve the sword puzzle. In the first approach, we will use circular linked list, while the second approach is based on general intuition. In this article, we will discuss what is a sword puzzle problem and how we can solve a sword puzzle problem. Problem Statement We have an arrangement of n people in a circle in which, first person is carrying a sword. The first person kills the second person and hands over the sword to the next alive person in the circle. Now the next person carrying the sword kills the next ...

Read More

Count subsequences 01 in string generated by concatenation of given numeric string K times

Esha Thakur
Esha Thakur
Updated on 09-Feb-2024 346 Views

The analysis and manipulation of strings are fundamental operations in many applications of computer programming. Counting subsequences with the pattern "01" in a string formed by repetitively concatenating a given numeric string poses an interesting challenge. The primary question is determining the total count of such subsequences in the resulting string. This article discusses a useful C++ approach to solve this issue successfully and offers a solid answer to deal with this particular work. Concept of Subsequence A subsequence is a sequence of characters that is derived from some other sequence by eliminating zero or more characters without altering the ...

Read More

Program to find the sum of series 1*2*3 + 2*3*4+ 3*4*5 + . . . + n*(n+1)*(n+2)

Disha Gupta
Disha Gupta
Updated on 05-Feb-2024 940 Views

The sum of the series is the value of all terms in the given series added together in a particular pattern. Here given pattern is in the form of the: ∑ (n*(n+1)*(n+2)) as (n*(n+1)*(n+2)) is the last term in the given pattern. The following article discusses 3 approaches in detail to find the given sum of the series with different time and space complexities. Problem Statement Now, let us see how to calculate the sum of series 1*2*3 + 2*3*4 + 3*4*5 + . . . + n*(n+1)*(n+2). Sample Examples Let’s try to understand this problem with the help ...

Read More

Count of substrings with the frequency of at most one character as Odd

Disha Gupta
Disha Gupta
Updated on 05-Feb-2024 461 Views

Substrings are the subsets or sequences of contiguous characters of a string. Now, in this problem, we need to find the number of substrings with the frequency of at most one character as odd. Let us see how we should proceed to solve this problem. Let’s try to understand this problem with the help of some examples. Input s = “ksjssjkk” Output 21 Explanation − As the frequency of the characters in the given string is given below− k → 3 s → 3 j → 2 Now, substrings with ...

Read More

Find the next number by adding natural numbers in order on alternating indices from last

Disha Gupta
Disha Gupta
Updated on 05-Feb-2024 214 Views

A numerical string is used to store a value of a number if we want to store a huge valued integer. As we know, we can not store a number greater than 32 bits in the computer with its datatype as int. So to avoid the overflowing condition, in this problem, we will take a numerical string as our input rather than an int variable so that we can work this problem on a larger scale of numbers. Problem Statement Now, in this problem, we need to find the following number by adding natural numbers in order on alternating indices ...

Read More

Maximize the String value by assigning values in the range [1, 26] to each character

Disha Gupta
Disha Gupta
Updated on 05-Feb-2024 321 Views

There are 26 total different alphabets exist in the English language. If we want to change the alphabet characters into numerical values then we need to assign the alphabet, values between 1 to 26 only. Now, in this problem, we need to Maximize the String value by assigning values in the range [1, 26] to each character. Let us see how we should proceed to solve this problem. Let’s try to understand this problem with the help of some examples. Input s = “blpsBpPtT” Output 221 Explanation Here, in this ...

Read More

The maximum length of string formed by concatenation having an even frequency of each character

Disha Gupta
Disha Gupta
Updated on 05-Feb-2024 196 Views

Concatenation is an operator which is used to join one or more than one string to originate a new string which would be a combination of strings that were used to generate it with the help of concatenation. In the following article, we will take the uppercase letters only in the input string. Concatenation is an operator which is used to join one or more than one string to originate a new string which would be a combination of strings that were used to generate it with the help of concatenation. In the following article, we will take the uppercase ...

Read More

Maximum possible number with concatenations of K numbers from a given array

Esha Thakur
Esha Thakur
Updated on 23-Jan-2024 488 Views

Finding the largest number that can be produced by concatenating K numbers from a given array is an exciting problem in the area of numerical manipulation and algorithmic difficulties. The sequence of concatenation must be carefully considered in this challenge because it affects the largest number's value. The complexity of the "Maximum Possible Number with Concatenations of K Numbers from a Given Array" problem is explored in this article. We will investigate a step-by-step method, and look at the C++ algorithmic implementation. By the end of this article, readers will have a thorough understanding of how to approach this issue ...

Read More

Lexicographically smallest numeric string having odd digit counts

Esha Thakur
Esha Thakur
Updated on 23-Jan-2024 352 Views

This article offers a thorough method for creating a lexicographically short N−length number string, where each digit must have an odd count. We offer an in−depth explanation of the problem statement, suggest a successful algorithmic strategy, and put it into practice using C++. The efficiency of the solution is revealed by the complexity analysis, and the accuracy and efficacy of the method are illustrated by an explanation using a test scenario Problem Statement Given a positive integer N, the task is to generate the smallest numeric string of size N which follows the lexicographical order, where each digit in the ...

Read More
Showing 2061–2070 of 4,496 articles
« Prev 1 205 206 207 208 209 450 Next »
Advertisements