Java Target Annotations

Shriansh Kumar
Updated on 23-Jul-2024 18:51:00

2K+ Views

When we start learning Java, we often wonder about symbols like @override and @inherited written within the code blocks. They are a special kind of tag termed as Annotations that can be applied to classes, methods, fields, parameters, and other elements of the code. The @Target annotation is one of the types of meta-annotations that specifies the defined annotation type applicable to which code block element. Don't get confused by these terms, we will clear all the doubts and confusion as we move forward in this article. The @Target Annotation of Java The first thing we need to understand is ... Read More

Convert Hexadecimal to Binary in Java

Mr. Satyabrata
Updated on 23-Jul-2024 18:32:23

2K+ Views

Binary Number − There are four types of number systems available. Binary number is one of them. The Binary number is represented by two digits i.e. one (1) and zero (0). The binary numbers are expressed as base-2 in the numeral system. Hexadecimal Number − Hexadecimal number is also one of the number systems available. The Hexadecimal number is represented with 16 digits which is from 0 to 15(0, 1, 2, 3... 15). From 10 to 15 it is represented as A to F. The Hexadecimal numbers are expressed as base-16 in the numeral system. Here we convert the hexadecimal ... Read More

Find First Non-Repeating Character from a Stream of Characters in Java

AmitDiwan
Updated on 23-Jul-2024 18:21:33

1K+ Views

Finding the first non-repeating character in a string is a common programming problem. It involves finding the first character that appears only once in the string. This task helps understand how to manipulate strings and use basic data structures in Java. Problem Statement Given a string, identify the first character that does not repeat. If all characters repeat, indicate that there is no non-repeating character. Input tutorialspoint Output The first non-repeating character of the string is T Steps to find the first non-repeating character from a stream of characters Below are the steps to find the first non-repeating character from a ... Read More

Style a Header with CSS

AmitDiwan
Updated on 23-Jul-2024 17:38:15

11K+ Views

To style a header with CSS, we can use various CSS properties to make it look attractive. In this article, we will learn and understand to style the header using diferent CSS properties. Style header with CSS We have used two h1 headings inside div element to add padding and background-color to header with div class name as header and test. In first heading with id head1, we have used "font-style: oblique;" and "text-align: center;"properties to add style and align it to center. In second heading with ... Read More

Align Flexbox Columns Left and Right Using CSS

Riya Kumari
Updated on 23-Jul-2024 16:17:47

21K+ Views

To align flexbox columns left and right using CSS, we can use various flexbox properties. In this article, we will learn and understand three different approaches to exaplain how to align flexbox columns left and right using CSS. We have created two flexible columns using div and flexbox, our task is to align flexible columns to left and right using CSS. Approaches to Align flexbox Columns Left and Right Here is a list of approaches to align flexbox columns left and right using CSS which we will be discussing in this article with stepwise explaination and complete example codes. ... Read More

Count Alternating Subarray

Revathi Satya Kondra
Updated on 23-Jul-2024 11:22:09

264 Views

The Count Alternating Subarrays are used to count the number of subarrays where no two adjacent elements are similar. we can also call these subarrays as alternating subarrays. Problem Statement Before understanding what is "Count Alternating Subarrays" let's see what is a sub-array, and alternating sub-arrays. A subarray is part of an array formed by removing some or no prefixes of the array and removing some or no suffix elements of the given array. While dividing an array into multiple sub-arrays there ... Read More

Find the Maximum Prime Difference

Revathi Satya Kondra
Updated on 23-Jul-2024 11:15:12

165 Views

The Maximum Prime Difference is a problem used to determine the largest difference between indices of two prime numbers in a given array. Problem Statement Here, we have given an array of integers as nums. our task is to find the maximum prime difference between the indices of any two prime numbers in an array. In the given array if we have only one prime number then it returns 0 and if no prime number returns -1. Example Scenario 1 Input: arr = [11, 4, 7, 6, 13] Output: 4 The prime numbers are 11 (index 0), ... Read More

Minimum Operations to Make Median of Array Equal to K

Revathi Satya Kondra
Updated on 23-Jul-2024 11:14:32

277 Views

The problem “Minimum Operations to Make the Median of the Array Equal to K” is used to adjust the elements of an integer array so that its median becomes equal to a given value k. In one operation, you can increase or decrease any element by 1. Problem Statement The goal is to find the minimum number of such operations to make the median of the array equal to K. The median of an array is the middle element when the array is sorted in non-decreasing order. The larger one is considered the median if there are two middle ... Read More

Longest Strictly Increasing or Decreasing Subarray

Revathi Satya Kondra
Updated on 23-Jul-2024 11:12:00

692 Views

The Longest Strictly Increasing or Strictly Decreasing Subarray problem is used to find the maximum length of the contiguous subarray within a given array where the elements are either strictly increasing or strictly decreasing. Problem Statement Given an array of integers nums, return the length n of the longest subarray of n which is either strictly increasing or strictly decreasing. Example Scenario 1 Input: nums = [1, 3, 2, 4, 3, 5, 4, 6] Output: n = 2 The longest strictly increasing subarrays are [1, 3], [2, 4], [3, 5], and [4, 6]. The longest strictly decreasing subarrays ... Read More

Latest Time After Replacing Characters

Revathi Satya Kondra
Updated on 23-Jul-2024 11:07:00

126 Views

The Latest Time You Can Obtain After Replacing Characters sub-task is applied to an input string, in which the string is represented as a 12-hour format time when the maximum number of characters are replaced by '?'. In a 12-hour format time, "HH:MM” where HH is an element from the set {00, 01, …, 10, 11} and MM is also an element from the set {00, 01, …, 59}. The earliest possible time is 00:00, and the latest time is 11:59. Problem Statement In this problem statement, the goal is to replace all "?" characters in the string s ... Read More

Advertisements