Shubham Vora has Published 962 Articles

Java Program to Find the Mth element of the Array after K left rotations

Shubham Vora

Shubham Vora

Updated on 05-Oct-2023 12:57:12

158 Views

In this problem, we will rotate the array by K left rotations and find the Mth element in the rotated array. The naïve approach to solve the problem is to rotate the array by K left rotation and take the element from the M – 1 index. The optimized approach ... Read More

Find index of pair among given pairs with just greater average

Shubham Vora

Shubham Vora

Updated on 05-Oct-2023 12:55:38

55 Views

In this problem, we will find the index value for each pair such that the resultant pair's average value is just greater than the current pair's average value. To solve the problem, we will use the sorting algorithm and binary search technique. We will use a sorting algorithm to sort ... Read More

Count unique Strings by replacing Consonant with closest vowel and vice versa

Shubham Vora

Shubham Vora

Updated on 05-Oct-2023 12:51:25

52 Views

In this problem, we will count the number of unique strings we can generate by replacing each vowel with the closest consonant and each consonant with the closest vowel. We can find the number of choices for each character of the string to replace the current character with other characters. ... Read More

Can String be considered as a Keyword?

Shubham Vora

Shubham Vora

Updated on 05-Oct-2023 12:50:26

103 Views

Keywords are important in any programming language, as they are reserved words with a particular predefined meaning. The keywords are used to define the variables, function, and class, change the program's control flow, traverse the list, etc. When we talk about the 'String', it is a fundamental data type to ... Read More

How to sort strings in JavaScript?

Shubham Vora

Shubham Vora

Updated on 14-Sep-2023 21:35:27

27K+ Views

The sorting string is to arrange strings in the dictionary or alphabetical order. It is usual to sort the array of strings while developing applications using JavaScript. In this tutorial, we will learn to sort strings in JavaScript. For example, string sorting is very useful here if you got some ... Read More

Extract a number from a string using JavaScript

Shubham Vora

Shubham Vora

Updated on 14-Sep-2023 15:57:17

31K+ Views

In JavaScript, there are multiple ways to extract a number from a string. One way is to use the match() method and a regular expression to search for all numeric digits in the string. Another way is to use the replace() method and a regular expression to remove all nonnumeric ... Read More

How to check whether a value is a number in JavaScript?

Shubham Vora

Shubham Vora

Updated on 14-Sep-2023 14:11:27

26K+ Views

In this tutorial, we will learn to check whether a value is a number in JavaScript. In JavaScript, it is necessary to check the variable's data type while performing some operation. Otherwise, it can create some unknown bugs in your application. For example, when users use the addition operator with ... Read More

How to format strings in TypeScript?

Shubham Vora

Shubham Vora

Updated on 14-Sep-2023 02:35:36

38K+ Views

In this tutorial, we will learn to format the strings in TypeScript. The string is the sequence of characters in any programming language, and the same goes for TypeScript. In TypeScript, strings are immutable. The meaning of the immutable is that we can’t change the string character at the particular ... Read More

How to pass an object as a parameter in JavaScript function?

Shubham Vora

Shubham Vora

Updated on 13-Sep-2023 15:33:27

31K+ Views

In this tutorial, we will learn how to pass an object as a parameter in a JavaScript function. One of JavaScript's data types is represented by the Object type. It is used to store keyed collections as well as more complex entities. The Object() function Object()or the object initializer / literal ... Read More

How to check whether a JavaScript date is valid?

Shubham Vora

Shubham Vora

Updated on 13-Sep-2023 14:43:57

29K+ Views

In this tutorial, we will learn to check whether a JavaScript date is valid or not. Let’s understand why we need to validate the date in JavaScript by example. Suppose you have developed an application that takes some information in the submission form from the user. Users can make a ... Read More

Advertisements