Found 7420 Articles for Java

Java Program for Queries for rotation and Kth character of the given string in constant time

Shubham Vora
Updated on 24-Aug-2023 16:53:07

102 Views

In this problem, programmers require to execute the queries on the string. Also, need to rotate the string and print the characters of the updated string. The best approach to solve the problem is that keep updating the index value and access string characters when we need to print the character. Problem statement – We have given the string alpha and the array containing the pair of numbers named ‘que’. The task is that perform the queries given in the array onto the string alpha. Follow the below query operation rules. (1, a) – Make total left rotations of ... Read More

Java Program for Check if a string can be formed from another string by at most X circular clockwise shifts

Shubham Vora
Updated on 24-Aug-2023 16:45:26

120 Views

In this problem, we need to convert one string to another by performing at most x circular shift operations on each character of the first string. The naïve approach to solving the problem is to rotate each character of the alpha1 string for x times, and we check if it matches the character of the alpha2 string, which is at the same index. The second approach is to solve the problem by finding the circular difference between characters at the same index. Problem statement – We have given a positive integer X. Also, we have given a string alpha1 ... Read More

Find Words which are Greater than given Length k using Stringstream

Avinash Gupta
Updated on 23-Aug-2023 21:30:42

235 Views

This is the problem based on stringstream class present in C++ “sstream” header file. Here, we have to find those strings whose lengths are greater than “k”. This task will be performed by using stringstream class. The concept is to partition the string and then iterate through the defined words. The value of length k has to be specified to obtain the words which are larger than k whereas the length of the words which are smaller than k will not be displayed in the output. In this article, we will understand how to find words which are greater than ... Read More

Length of Longest Common Subsequence Containing Vowels

Avinash Gupta
Updated on 23-Aug-2023 21:28:51

293 Views

In this problem, our task is to find the length of the longest possible subsequence present in two strings such that every letter of the subsequence must be a vowel. With the help of the recursive algorithm and iterative algorithm, the given problem statement can be solved. In English Alphabet, there exist five vowels named 'A', 'E', 'I', 'O', 'U'. Subsequence Vs. Substring: In Subsequence, we may take characters in a non-continuous way, but in Substring, we can take only continuous characters. Ex: In String “TutorialsPoint”: “tri” is a subsequence but not a substring. While “tor” is both subsequence ... Read More

Remove Duplicates from a String in O(1) Extra Space

Avinash Gupta
Updated on 23-Aug-2023 17:04:35

373 Views

In this problem, our task is to remove all the duplicate characters present in the string other than the first occurrence of every character. Also, it's required to solve the problem without using any extra space, and the Space complexity must be O(1). Various approaches are used in this article. The Boolean array is defined in one approach to determine the repetition of the characters where the index of Boolean array is mapped to each alphabet. In the second approach, the concept of the Bit manipulation is used to remove the repeated characters from the resultant string. Let's explore ... Read More

Sort Elements on the basis of the Number of Factors

Avinash Gupta
Updated on 23-Aug-2023 16:47:22

671 Views

In this problem, our task is to sort the array of integers based on several factors of numbers present in the array as a priority. The array is the best way to store similar types of elements in java. But if the number of factors becomes equal in any two numbers, then as a second priority, this algorithm sees numerical value. Factors are the numbers by which the given number is divisible entirely without leaving any remainder. This article uses various approaches to sort elements based on several factors. To show you some instances Instance-1 If Array = ... Read More

What does “!” mean in Java?

Priya Mishra
Updated on 23-Aug-2023 13:46:19

2K+ Views

Introduction Java supports eight types of operators; the “!” operator is one of them. In Java, an operator is a symbol used to execute operations. Operators are entities that can modify the values of operands. Java makes authoring, compiling, and debugging code simple. It is helpful in creating code that can be reused and applications that are modular. It was created with the goal of having a few implementation dependencies as feasible. Let’s discuss in detail about the Java operators, “!” operator and where to use it with some working examples. Java operators Operators in Java are symbols that are ... Read More

What is meant by object in Java?

Priya Mishra
Updated on 23-Aug-2023 13:40:23

184 Views

Introduction In real life, we can call tables, chairs, lamps, etc. objects as they have some attributes and functions. We can say that anything that has attributes or properties and some functionality like a lamp has a stand and a bulb and it can light up a room so it is an object. In Java also, we have objects and they have their own properties. Objects are basically the instance of the class and the class provides a blueprint for the creation of an object. Let’s have a brief discussion on objects and how to create an object in Java. ... Read More

How are Java and C++ related?

Priya Mishra
Updated on 23-Aug-2023 12:54:52

174 Views

Introduction These days, Java and C++ are widely utilized in competitive programming. These two programming languages are utilized generally in industry and competitive programming due to their impressive characteristics. C++ is a commonly used programming language due to its efficiency, fast speed, and dynamic memory use. In terms of software development, Java is incomparable to any other programming language. Java is extensively utilized in the IT sector. Now we will look into how Java and C++ are similar. What is Java? Java is an Object-Oriented programming, general-purpose, and high-level language. It is mainly used for coding web applications. Java ... Read More

What is the full form of Java?

Priya Mishra
Updated on 22-Jun-2024 19:36:03

4K+ Views

What is the Full Form of JAVA? The full form of Java is "Just Another Virtual Accelerator". Java is not an abbreviation but some programmers made a full form. Basically, Java doesn’t have any full form or special meaning. This full form is used jokingly by the programmers. J Just A Another V Virtual A Accelerator Related Links Some of the related topics, you may like to read: Overview of Java programming language Features of Java programming language

Advertisements