Found 2620 Articles for Java

How to Create and Setup Spring Boot Project in Eclipse IDE?

Harischandra Prasad
Updated on 16-Oct-2023 12:26:38

197 Views

The Spring Boot framework incorporates all of Spring's capabilities and features because it is built upon the basis of Spring. Developers are drawn to it because of its effective production-ready environment, which frees them up to focus on the logic of the application rather than on setup and configuration. Microservices-based applications that are suitable for deployment in a production environment may be created quickly thanks to Spring Boot. Some of the key features of Spring Boot are − Auto-configuration − Spring Boot's standout feature is its auto-configuration capability. It analyzes the project's classpath and automatically configures the necessary beans ... Read More

How to Create and Modify Properties File Form Java?

Harischandra Prasad
Updated on 16-Oct-2023 12:21:50

44 Views

Program in Text and XML Format? In Java, a project's properties file is made up of text-based key-value pairs that are commonly stored with the .properties extension. The key-value pair of contents are presented line by line, and they are often created using notepad, Wordpad, etc. Properties files serve as valuable repositories for storing critical and confidential data. In this article, we will explore the process of creating a properties file using a Java program. The Properties class in this (java.util.Properties) package offers multiple utility store methods that facilitate the storage of properties in either Text Format or XML ... Read More

How to Create a TreeMap in Reverse Order in Java?

Harischandra Prasad
Updated on 16-Oct-2023 12:18:37

119 Views

In this article, we will learn how to create a TreeMap in reverse order in java. Firstly, we need to know about TreeMap. A TreeMap in Java is a class that implements the SortedMap interface, which extends the Map interface. It is a collection that stores key-value pairs and organizes them based on their natural order or a custom Comparator provided during its creation. This approach provides efficient performance for common operations such as adding, removing, and retrieving elements from the TreeMap. It has an average time complexity of O(log n), which ensures efficient execution. Syntax for Creating a TreeMap ... Read More

How to Create a Thread-Safe ConcurrentHashSet in Java?

Harischandra Prasad
Updated on 16-Oct-2023 12:14:02

125 Views

In this article, we will see what are the possibilities available to create thread-safe HashSet instances and see what will be equivalent to ConcurrentHashMap for HashSet. We will also look at the benefits and drawbacks of each approach. Before JDK8 we are not able to create a Thread Safe ConcurrentHashMap because  java.util.concurrent package in JDK8 does not provide a class named ConcurrentHashSet, two new methods were added that are discussed below. ConcurrentHashMap is the Map implementation that allows us to modify the Map while iterating. The ConcurrentHashMap operations are thread-safe. ConcurrentHashMap doesn't allow null for keys and values. Ways to ... Read More

Lexicographically smallest numeric string having odd digit counts

Esha Thakur
Updated on 23-Jan-2024 10:09:28

80 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

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

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

69 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

70 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

61 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

129 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

145 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

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