- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9344 Articles for Object Oriented Programming
88 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
150 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
175 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
135 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
75 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
158 Views
You are given a keypad of mobile, and the keys that need to be pressed, your task is to print all the words which are possible to generate by pressing these numbers. Input Output Scenarios Let’s go through an example to understand this more: Input str = "32" Output [gd, hd, id, ge, je, ie, gf, hf, if] The characters that can be formed by pressing 3 is g, h, i and by pressing 2 characters d, e, f can be formed. So all the words will be a combination where first character belongs to g, h, ... Read More
166 Views
The task is to generate a string that consists of characters ‘a’ and ‘b’ which satisfies the condition mentioned below: str must have a length of A+B. The character 'a' must appear A times and the character 'b' must appear B times within the string. The sub−strings "aaa" and "bbb" should not appear in str. After generating the string, it should be printed. One possible solution is to first generate a string with all 'a's and 'b's, with 'a' occurring A times and 'b' occurring B times. Then, we can shuffle the string randomly until we find a ... Read More
112 Views
In this problem, we need to find the length of the longest subsequence having the same left and right rotations. We can solve the problem using the brute-force approach, finding all possible subsequences of the given string and checking each subsequence one by one to see if it has the same left and right rotation. We find the maximum length of such subsequence. The problem with this approach is that it is very time-consuming as its time complexity is O(2N). So, we will learn to write optimized code in this approach. Problem statement – We have given string str containing ... Read More
538 Views
A prime number is a positive integer greater than 1 that is only divisible by 1 and itself. Prime numbers are an essential concept in mathematics and computer science. They are integers that are only divisible by 1 and themselves. Finding prime numbers is an important task in many algorithms, and there are several methods to determine if a number is prime. One such problem is finding the closest prime number to a given number. Here, we will explore how to find the closest possible prime number of any number. Let's start! For instance Given integer ... Read More