Print All Non-Boundary Elements of Matrix in C++

AYUSH MISHRA
Updated on 20-Nov-2024 23:05:54

22K+ Views

A matrix is a two-dimensional array. The elements that are present on the edges are called boundary elements, and the elements that are present inside the matrix, not present on the edges, are known as non-boundary elements. In this article, we are going to discuss how to print non-boundary elements of the matrix. Problem Description We are given a matrix and we have to print all non-boundary elements present in the matrix. Rows and columns are present ... Read More

Check Palindrome String in Java

Ayyan
Updated on 20-Nov-2024 22:41:36

19K+ Views

In this article, we will learn how to check whether a string is a palindrome in Java. A palindrome reads the same forward and backward. By using the StringBuffer class and its reverse() method. Problem StatementGiven a string, write a Java program to check if it is a palindrome by reversing the string and comparing it with the original.Input "anna"Output Given String is palindrome Steps to check if a string is a palindrome The following are the steps to check if a string is a palindrome − Create a StringBuffer object by passing the ... Read More

Subtract Hours from Current Time Using Calendar Add Method in Java

Samual Sam
Updated on 20-Nov-2024 22:39:59

776 Views

In this article, we use the Calendar class in Java to work with dates and times. First, it retrieves the current date and time and displays it. Then, the program increments the current time by 5 hours using the add() method and displays the updated date and time. This is a simple example of modifying and handling date-time values programmatically. Subtracting hours from current time using Calendar.add() method. Calendar class The Java Calendar class is found in the java.util package. It is an abstract class that provides methods for converting a specific moment in time into various calendar fields such ... Read More

Merge Contents of All Files in a Directory in Java

AmitDiwan
Updated on 20-Nov-2024 22:39:25

1K+ Views

In this article, we will learn how to merge the contents of all the text files in a directory into a single file using Java. It reads the data from each file and writes it into a new file while ensuring all data is stored in an organized manner. You’ll see how to handle files, read their content, and merge them programmatically. File class The java.io package contains the Java File class,  which provides an abstract representation of file and directory pathnames. It is commonly used for creating files and directories, searching for files, deleting files, and performing other file-related operations. File ... Read More

File Searching Using Python

SaiKrishna Tavva
Updated on 20-Nov-2024 17:41:08

41K+ Views

File Searching in Python can be done using various methods, like using the os module with os.walk() function as it takes a specific path as input and generates a 3-tuple involving dirpath, dirnames, and filenames. Another method is using the pathlib module which provides an object-oriented interface while working on file systems paths. In Python there are some widely used methods to search for specific files, some of them are as follows - Os Module: This module allows us to interact with the operating system. ... Read More

Pass by Reference vs Value in Python

SaiKrishna Tavva
Updated on 20-Nov-2024 17:40:48

11K+ Views

In Python Call by Value and Call by Reference are two types of generic methods to pass parameters to a function. In the Call-by-value method, the original value cannot be changed, whereas in Call-by-reference, the original value can bechanged. Call by Value in Python When we pass an argument to a function, it is stored locally (in the stack memory), i.e the scope of these variables lies with in the function and these will not have effect the values of the golbal variables (variables outside function). In Python, "passing by value" is possible only with the immutable types such as integers, floats, strings, ... Read More

Check If a Variable Is an Array in JavaScript

vineeth.mariserla
Updated on 20-Nov-2024 17:11:18

4K+ Views

To check if a variable is an array in Javascript is essential to handle data appropriately. We will discuss three different approaches to check if a variable is an array or not. We are having an array and a string, and our task is to check if a variable is an array in JavaScript. Approaches to Check if a Variable is an Array Here is a list of approaches to check if a variable is an array in JavaScript which we will be discussing in this article with stepwise explaination and complete example codes. Using ... Read More

Read Contents of a JSON File Using Java

Aishwarya Naglot
Updated on 20-Nov-2024 15:20:27

10K+ Views

JSON or JavaScript Object Notation is a lightweight text-based open standard designed for human-readable data interchange. Conventions used by JSON are known to programmers and include C, C++, Java, Python, Perl, etc. Sample JSON document − { "book": [ { "id": "01", "language": "Java", "edition": "third", "author": "Herbert Schildt" ... Read More

SQL Query to Delete Duplicate Rows

Mithlesh Upadhyay
Updated on 20-Nov-2024 14:59:50

189 Views

While working with a database to avoid duplicates, we should follow certain practices when we create the database table. Define primary key to identify rows cluster and non-cluster indexes. Use constraints for data integrity in performance. Database tables may have duplicate rows after following best practices. These duplicate rows create issues while we retrieve data from the database. So we must ensure unique database rows. To do so, first of all, we need to verify whether a table has duplicate rows, If duplicate rows exist, we must remove them by altering the table data. This article will ... Read More

Select a Random Element from Array in JavaScript

Rohan Singh
Updated on 20-Nov-2024 14:39:51

4K+ Views

To select a random element from array in Javascript, means getting any random element from the given array. We will understand various approaches for selecting a random element from array. In this article, we are having an array and our task is to select a random element from array in JavaScript Approaches to select a random element from array Here is a list of approaches to select a random element from array in JavaScript which we will be discussing in this article with stepwise explaination and complete example codes. Using Math.random() Method ... Read More

Advertisements