For a given circle with radius "r", write a Java program to find the perimeter of that circle. The circumference is also known as the perimeter. It's the distance around a circle. Circumference is given by the formula C = 2𝜋r where, pi/𝜋 = 3.14 and r is the radius of the circle − Example Scenario Input: radius = 5 Output: perimeter = 31.400000000000002 2 * 3.14 * 5 = 31.428571428571427 By Defining Constant Value for PI In this Java program, we define the value of PI as a constant and find the perimeter of circle ... Read More
To join two given lists the addAll() method of the java.util.ArrayList class is used to insert all of the elements in the specified collection into this list. To add contents of a list to another − Problem Statement Write a program in Java to join two given lists − Input Contents of list1 ::[Apple, Orange, Banana] Contents of list2 ::[Grapes, Mango, Strawberry] Output Contents of list1 after adding list2 to it ::[Apple, Orange, Banana, Grapes, Mango, Strawberry] Steps to join two given lists Following are the steps to join two given lists − ... Read More
Finding a subarray with a given sum is a common problem that often appears in coding interviews and competitive programming. This problem can be solved using various techniques, each with its own trade-offs regarding time complexity and space complexity. In this article, we'll explore multiple approaches to solving the problem of finding a subarray with a given sum in Java. Problem Statement Given an array of integers and a target sum, find a continuous subarray in the array that adds up to the given sum. The problem can be divided into two main variants: Subarray ... Read More
In this article, we’ll explore two methods to remove duplicate elements from a stack in Java. We’ll compare a straightforward approach with nested loops and a more efficient method using a HashSet. The goal is to demonstrate how to optimize duplicate removal and to evaluate the performance of each approach. Problem statement Write a Java program to remove the duplicate element from the stack. Input Stack data = initData(10L); Output Unique elements using Naive Approach: [1, 4, 3, 2, 8, 7, 5] Time spent for Naive Approach: 18200 nanoseconds Unique elements using Optimized Approach: [1, 4, 3, 2, ... Read More
CSS wildcard selectors allow us to select an HTML element containing the particular substring in the value of the particular attribute, such as classes, id or other attributes. It is useful when style is applied to multiple elements having a common pattern in their attributes. In this article, we will be learning about wildcard selectors in CSS and it's types which are mentioned below. Contains (*=) wildcard selector Starts with (^=) wildcard selector Ends with ($=) wildcard selector Contains (*=) wildcard selector CSS contains(*=) wildcard ... Read More
To create the Indian flag using HTML and CSS, we will need to have good understanding of CSS. Indian flag have three colors: saffron, white and green and Ashoka Chakra at the middle. In this article, we will be creating stepwise Indian flag. First making a pole then tricolor and then rotating Ashoka chakra all with the help of HTML and CSS only. Later we will be animating our flag with wave animation and flag movement. These are the steps which we will be following: .flag-container { ... Read More
YAML and JSON are serialization formats which are a mechanism for the exchange of human-readable data. The data is formatted in such a way that it can be easily exchanged between applications. Both methods use key-value pairs for data exchange. In this article, we will discuss the difference between YAML and JSON. What is YAML? YAML is a data interpretation language which can represent human-readable data. It is a lightweight language and consists of complicated features to format the data which could be easily read by humans. YAML acts as a superset of JSON so the data available in JSON ... Read More
CSS grouping selector is used to select multiple elements and style them together. This reduces the code and extra effort to declare common styles for each element. To group selectors, each selector is separated by a space. In this article, we will be understanding how to apply grouping selectors in CSS. Applying Grouping Selectors in CSS We have applied grouping selector using element name and using id of the element. We have used div and article element as grouping selector to apply background-color, color and text-align properties to div and article tag making it center ... Read More
One of the important aspects of business development is the design of a Data Warehouse in which a schema is used to collect different data sources. The two popular architectures used to design a data warehouse are Kimball and Inmon. In this article, we will discuss the difference between Kimball and Inmon. What is Kimball? Ralph Kimball introduced the Kimball approach to design a data warehouse. This is an approach in which business processes and questions are recognized and the answer to these questions has to be given by the data warehouse. The information provided by the data warehouse is ... Read More
Apache Software Foundation is the company that owns the Apache Tomcat Server and Apache Web Server. Apache Tomcat Server works as a container for Java Servlet and Apache Web Server is an HTTP server. Many users get confused between both of these servers. In this article, we will discuss the difference between Apache Tomcat Server and Apache Web Server. What is Apache Tomcat Server? Apache Tomcat is a server which works as a container for Java Servlets. Apache Tomcat Server was developed in 1998 and now it has become one of the best JavaScript web hosting solutions. It is also ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP