Shriansh Kumar has Published 324 Articles

JavaScript: How to Find the Middle Element of a Linked List?

Shriansh Kumar

Shriansh Kumar

Updated on 30-Sep-2024 16:02:06

2K+ Views

For a given linked list, write a program in JavaScript to find its middle element. Here, linked lists are a type of linear data structure. If there are an even number of elements in the linked list, there will be two middle nodes. In this case, the middle element would ... Read More

JavaScript function to take a number n and generate an array with first n prime numbers

Shriansh Kumar

Shriansh Kumar

Updated on 30-Sep-2024 16:01:16

2K+ Views

We are required to write a JavaScript function that takes in a number n and returns an array that contains first n prime numbers. We know that prime numbers are those numbers that are only divisible by 1 and themselves like 2, 3, 19, 37, 73 etc. Let's understand the ... Read More

Java Program to Get CPU Serial Number for Windows Machine

Shriansh Kumar

Shriansh Kumar

Updated on 30-Sep-2024 15:58:31

981 Views

The serial number of a CPU is a unique identifier which is given to a particular CPU by the manufacturer to each of them. Its main purpose is to track and identify the hardware for warranty claim. In this article, we are going to write a java program to get ... Read More

Java Program to Display Name of the Weekdays in Calendar Year

Shriansh Kumar

Shriansh Kumar

Updated on 30-Sep-2024 15:56:38

746 Views

There are 5 weekdays in a week, which are Monday, Tuesday, Wednesday, Thursday and Friday. The two remaining days i.e. Saturday and Sunday make up the weekend. In this article, we will learn how to write a Java program to display name of the weekdays in a calendar year. ... Read More

Java Program to display Current Time in another Time Zone

Shriansh Kumar

Shriansh Kumar

Updated on 30-Sep-2024 15:54:09

2K+ Views

A time zone is a region of the globe that observes a uniform standard time for legal, commercial, and social purposes. Suppose you have an application that is running in India as well as Japan. Here, you can't use the same time zone for both regions. Therefore, it is necessary ... Read More

Java Program to Print Summation of Numbers

Shriansh Kumar

Shriansh Kumar

Updated on 30-Sep-2024 15:46:44

791 Views

Suppose you are given a set of numbers, your task is to write a Java program to print their summation. To find summation, you need to add all the given numbers with the help of addition operator. In Java, a set of numbers can be represented by an array. ... Read More

Java program to check if a Substring is present in a given String

Shriansh Kumar

Shriansh Kumar

Updated on 25-Sep-2024 18:44:28

1K+ Views

Suppose you are given two strings, your task is to write a Java program that checks whether the second string is the sub-string of the first one. String in Java is an immutable sequence of characters and sub-string is its small portion. Example Scenario: − Input 1: str = ... Read More

Java program to reverse each word in a sentence

Shriansh Kumar

Shriansh Kumar

Updated on 25-Sep-2024 18:27:47

2K+ Views

Given a sentence or string, write a Java program to reverse each word in that sentence. Each word in that sentence should be reversed and at the same time, they should be in the same order as before. Let's understand the problem with an example − Example Scenario: Input: ... Read More

Java Program to Reverse a String

Shriansh Kumar

Shriansh Kumar

Updated on 25-Sep-2024 18:03:35

2K+ Views

Given a String, let's say "str", write a Java program to reverse it. In reverse string operation, we need to display the individual characters of string backwards or from right to left. Here, String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”). ... Read More

Java Program to Print the ASCII values

Shriansh Kumar

Shriansh Kumar

Updated on 13-Sep-2024 16:14:00

1K+ Views

For a given character, say "ch", write a Java program to print its ASCII value. We can find the ASCII value of any character by assigning it to an integer value and printing that integer value. The term ASCII stands for American Standard Code for Information Interchange. There are 128 ... Read More

Advertisements