Found 7421 Articles for Java

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

Esha Thakur
Updated on 23-Jan-2024 10:15:32

349 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

Make Palindrome binary string with exactly ‘a’ 0s and ‘b’ 1s by replacing wild card '?'

Esha Thakur
Updated on 23-Jan-2024 09:46:41

371 Views

When dealing with string manipulation problems, it's common to encounter scenarios where we need to transform a given string into a specific pattern or format. One such problem is making a palindrome binary string with a certain number of '0's and '1's while replacing wildcard characters represented by '?'. In this article, we will explore an efficient algorithmic approach to solve this problem using C++. We'll discuss the problem statement, and its approach, and analyze the time and space complexity of the algorithm. Problem Statement Given a string consisting of '0's, '1's, and wildcard characters '?', we need to convert ... Read More

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

Esha Thakur
Updated on 09-Feb-2024 15:51:54

224 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

Find the single-digit sum of the alphabetical values of a string

Esha Thakur
Updated on 22-Jan-2024 18:16:06

477 Views

In order to find the single−digit sum of the alphabetical values of a string, we will explore the alphabetical values of a string and assign numerical values to letters of the alphabet. We will jump into the concept and an example to illustrate the steps involved, the algorithm behind this process, an example code implementation in C++, and finally a brief conclusion involving the significance of this technique. Concept The idea rotates around associating numerical values with each letter and performing arithmetic operations to calculate the single−digit sum i.e. 'A'=1 or 'a'=1, 'B'=2 or 'b'=2, and so on. By converting ... Read More

Java Program to Find the Mth element of the Array after K left rotations

Shubham Vora
Updated on 05-Oct-2023 12:57:12

231 Views

In this problem, we will rotate the array by K left rotations and find the Mth element in the rotated array. The naïve approach to solve the problem is to rotate the array by K left rotation and take the element from the M – 1 index. The optimized approach is to find the final index value in such a way that the final index is the M – 1 index of the rotated array. Problem Statement We have given a nums[] array containing the positive integers. We have also given the positive integer K and M. We need ... Read More

Fibonomial coefficient and Fibonomial triangle

Vaishnavi Tripathi
Updated on 09-Feb-2024 17:14:59

129 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

Java notify() Method in Threads Synchronization with Examples

Bamdeb Ghosh
Updated on 04-Oct-2023 18:42:37

346 Views

Introduction The Object class contains a definition for the notify () method. Only one thread that is waiting for an item is wakes up by it and that thread then starts to run. A single thread can be awakened using the notify () method of the thread class. When using the notify () method while several threads are waiting for a notice, only one thread will actually get the notification and forces the others to continue waiting. Let us discuss the Java notify () method in Threads Synchronization, along with its usage and programming examples. We will look into how ... Read More

Java Multicasting (Typecasting multiple times) Puzzle

Bamdeb Ghosh
Updated on 04-Oct-2023 18:39:35

370 Views

Introduction Java Multicasting known as typecasting multiple times. It is the process of converting a value from one data type to another and it involves multiple typecasting conversions. It allows us to change the data type of a variable to perform operations that would not be possible otherwise. Let us discuss multicasting in Java. We will talk about numeric multicasting to convert between numeric data types. We will also discuss object multicasting to treat subclass objects as superclass objects. We will also provide simple programming examples to understand this topic easily. Numeric Multicasting in Java In this programming example we ... Read More

Java Method Parameters

Bamdeb Ghosh
Updated on 04-Oct-2023 18:35:39

2K+ Views

Introduction We know that Java Method Parameters are variables used in method declarations to accept inputs and enable the methods to work with data that are dynamic. Let us discuss the Java Method Parameters and their use in making methods reusable and adaptable. We will discuss the importance of data input, code reusability, and flexibility. We will also explain about the pass−by−value and pass−by−reference by using Java Parameters with basic programming examples. By understanding the article, we hope our readers will understand the importance of the Java Method Parameters as it helps to create essential and maintainable Java programs. Definition ... Read More

Java JSON Processing (JSON-P) with Example

Bamdeb Ghosh
Updated on 04-Oct-2023 18:14:08

317 Views

Introduction Java programs can operate with JSON data due to the strong Java JSON Processing (JSON-P) API. Web servers and clients frequently exchange data using the lightweight JSON data transfer standard. JSON-P offers the Object Model API and the Streaming API as its two primary methods for processing JSON data. Let us talk about these two strategies and use examples to show how they work and what they can do. We hope that our readers will learn about the Object Model API and Streaming API, together with Programming examples, by understanding this article's explanations on Java JSON Processing (JSON-P) with ... Read More

Advertisements