The smallest missing number is the smallest number that is missing from a stream of elements or in an Array. The stream may or may not contain continuous elements. If the stream is continuous then the smallest missing number is nothing but the Smallest Missing Number in a stream. In this section, we will discuss the various approaches to find a Smallest Missing Number in a stream of elements using Java programming language. Problem Statement Given a stream of integers find the smallest missing number from the stream. Input 1 arr=[1, 2, 3, 5, 6, 7, 8] Output 1 ... Read More
In this article, we will learn to find unique words in a string using the Map utility of Java because of its property that it does not contain duplicate keys. To find unique words first get all words in the array to compare each word, for this split string based on space/s. If other characters such as comma(, ) or full stop (.) are present then using required regex first replace these characters from the string. Insert each word of string as the key of Map and provide the initial value corresponding to each key as is unique if this ... Read More
In this article, we will learn how to retrieve the highest key stored in a TreeMap. We will create a simple Java program that demonstrates how to create a TreeMap, add key-value pairs to it, and then use the lastKey() method to find the highest key in the map. Problem Statement Write a Java program to get the highest key stored in TreeMap. Input {1=PHP, 2=jQuery, 3=JavaScript, 4=Ruby, 5=Java, 6=AngularJS, 7=ExpressJS} Output Highest key in TreeMap: 7 Steps The followingare the steps to get the highest key in TreeMap − First, import the classes. ... Read More
In this article, we will learn to swap two numbers using Java. We will use the Scanner class to get the user input and perform the swapping temporary variable. Read integers from users using the nextInt() method of the Scanner class. Steps to swap two integers Following are the steps to swap two numbers in Java− Import the Scanner class. Create a variable (temp), and initialize it with 0. Assign 1st number to temp. Assign the 2nd number to the 1st number. ... Read More
To rotate an element using CSS, is a powerful tool to control and enhance the visual presentation of a website. In this article, we will be understanding three different approaches to rotate an element Using CSS. We are having an image and a div box with text content written in it, our task is to rotate element using CSS. Approaches to Rotate an Element Using CSS Here is a list of approaches to rotate an element using CSS which we will be discussing in this article with stepwise explaination and complete example codes. Rotate using ... Read More
Using Python Programming to solve PDV work problems In cases of closed systems which are also called as systems where the identity of mass does not change, the system interacts with its surroundings either in terms of heat or work. In this article, we will be dealing with the non-dissipative work interaction which is also known as the PDV or displacement work. We will be using Python programming to solve these problems. But before we start, one should know the fundamental meaning of displacement work. The displacement work is evaluated as the integral of the path the system has taken ... Read More
To force PHP to use strings for array keys is quite easy, as in PHP array keys are automatically stored as integers if the array elements are numbers. If they are not numbers then it will cast to strings. Forcing PHP to Use strings for Array Keys Following are the ways to force PHP to use strings for array Keys Using php array() function Using json_encode() function Using php array() Function If you use the array() function and keep the first key in quotes it will take other keys as a string does not matter if you are ... Read More
A queue is a linear data structure where elements are stored in the FIFO manner. Here, FIFO stands for First In First Out which means the first element inserted would be the first element to be accessed. In this article we will see how to perform different queue operations like Enqueue and Dequeue using Java programming language. Queue in Java In Java, the Queue interface, a sub interface of Java Collection Interface, provides the features of queue data structure. Since it is an interface, the Queue interface needs a concrete class for the implementation and the most common classes are ... Read More
LinkedHashSet is a class provided by Java that implements Set Interface. The first element of a LinkedhashSet is nothing but the first element in the collection. In this article, we will discuss different approaches to get the first element from LinkedHashset. What is a LinkedHashSet? A LinkedHashSet is a collection which is a combination of HashSet collection and a LinkedList collection. A HashSet is an unordered collection which doesn't allow duplicates. But, a LinkedList is an ordered collection which stores duplicates Coming to LinkedHashSet as it is a combination of both HashSet and LinkedList it stores the elements in ... Read More
A stack is a linear data structure where elements are stored in the LIFO manner. Here, LIFO stands for Last In First Out which means the last element inserted would be the first element to be accessed. In Java, stack is a class provided by the Java collection framework and it implements the Stack data structure. In this article we will write Java program to find if an element is in stack or not. Using Stack.search() Method The method java.util.Stack.search() is used to find if an element is in the stack or not in Java. This method takes a ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP