Problem Description In this problem, we are given two numbers and we have to find the value obtained after subtracting one number from another. In this article, we are going to learn how we can subtract two numbers in C++ using different approaches. Example 1 Input number1 = 8number2 = 12 Output 4 Explanation The subtraction of number2 - number1 i.e. 12 - 8 will result in 4. Example 2 ... Read More
Problem Description We are given an array that contains numbers from 1 to n, and one number is missing between the given numbers from 1 to n. We have to return the missing number in O(1) time complexity. In this problem, we are going to discuss how we can find the missing number in an array. Example 1 Input: array = {1, 2, 3, 5, 6, 7} Output: 4 Explanation From 1 to 7, the number 4 is missing in the given array. Example 2 ... Read More
ResultSet holdability determines whether the ResultSet objects (cursors) should be closed or held open when a transaction (that contains the said cursor/ ResultSet object) is committed using the commit() method of the Connection interface. The setHoldability() method of the Connection interface is used to set the holdability of the ResultSet objects in this connection (created using this connection) to a desired value. Syntax Following is the syntax of the Java Connection setHoldability() method − void setHoldability(int holdability) throws SQLException; Parameters This method accepts an integer value named "holdability", which is described below − Representing the ResultSet ... Read More
In Java, the HashMap class is a part of the Java.util package and provides a convenient way to store key-value pairs. Sometimes, We need to update the values of existing keys while keeping the keys identical. This can be easily achieved using the put() method, replace() method, and computeIfPresent() method which allows to replace the value with a specific key. Creating a HashMap and setting key-value pair − Mapmap = new HashMap(); map.put(10, "A"); map.put(20, "B"); map.put(30, "C"); Now, let's set a different value for an identical key using the put(), replace(), and computeIfPresent() methods − map.put(10, "T"); map.replace(10, "T"); map.computeIfPresent(10, ... Read More
In Java, converting a string to lowercase or uppercase is a common operation used in text processing, formatting, and case normalization. The String class provides built-in methods to achieve this with ease. This article explores how to use these methods with practical examples, demonstrating step-by-step how to convert strings between uppercase and lowercase. Key Methods toLowerCase(): Converts all characters in a string to lowercase. toUpperCase(): Converts all characters in a string to uppercase. These methods are part of the java.lang.String class and work seamlessly for any string input. Using toLowerCase() ... Read More
In this article, we will learn to convert an array with a null value to a string in Javascript. Handling arrays containing null, undefined, and falsy values in JavaScript is a frequent challenge. The default methods might not behave as expected when converting such arrays to strings, requiring custom solutions for meaningful string representations. Problem Statement Given an array containing null, undefined, empty strings, and other values, the task is to concatenate its elements into a single string while excluding the unwanted values. Following is our array, with some null and undefined values − Input ["Here", "is", null, "an", undefined, ... Read More
In this article, we will learn to mark and reset the current position in a file input stream in Java. Marking the current position in an input stream is a crucial functionality provided by Java’s InputStream class. It enables developers to reset the stream to a previously marked position, facilitating efficient data handling, especially in scenarios like re-reading or backtracking within a file. Key Concepts Following are the key concepts we need to know to mark the current position in this input stream − InputStream Class: The InputStream class is an abstract class that represents ... Read More
The Float wrapper class provides methods to convert a Float object into various numeric primitive data types like short, int, float, and double in Java. This is particularly useful when handling float values and representing them in different numeric forms.This article will show two approaches to convert a Float object to numeric primitive types using the Float class methods. Using Float Wrapper Class Methods In this approach, we use predefined methods of the Float class, such as shortValue(), intValue(), floatValue(), and doubleValue(), to convert a Float object into various primitive types. These methods directly perform the required conversions. ... Read More
In this article, we learn the Connection getTransactionIsolation() method in Java, which allows you to determine a database connection's current transaction isolation level. Transaction isolation levels dictate how transactions interact, particularly regarding data locking during reads or writes. What is the getTransactionIsolation() Method? The getTransactionIsolation() method is part of the Connection Interface in Java. It returns an integer constant representing the current isolation level of the database connection. JDBC provides support for 5 transaction isolation levels through the Connection interface − TRANSACTION_NONE: It is represented by an integer value 0 and does not support transactions. ... Read More
Cloud services like Alibaba Cloud MaxCompute and Amazon Neptune offer powerful capabilities tailored to different needs. While MaxCompute specializes in big data analytics and batch processing, Neptune is optimized for managing highly connected datasets with graph database technology. Understanding their differences can help businesses choose the right solution.What is Alibaba Cloud MaxCompute?Alibaba Cloud MaxCompute is a cloud-based platform designed for processing large-scale datasets. It is ideal for data warehousing, batch processing, and executing complex analytical tasks on structured and semi-structured data. With its SQL-like language, MaxCompute simplifies querying, while its columnar storage ensures high performance for analytical queries.Its key features ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP