Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Sourav Sarkar
2 articles
Length of longest balanced parentheses prefix using Java
In this article we will explore how we can find the length of longest balanced parentheses prefix using java , first we will understand the problem with some examples then we learn two different approaches to find it. Problem Statement Here, we will be given a string with parentheses and we need to find the length of balanced parentheses set from the string i.e. for every open parentheses "(" if there is a close parentheses ")", then we call it balanced. Prefix defines the first balanced set from the string, let the parenthesis set '(())()' we consider only '(())' Input ...
Read MoreDelete middle element of a stack in Java
In order to delete the middle element of a stack, then first we need to remove the elements above the middle element. After removing the middle element, we restore the elements above it to maintain the original sequence. We can achieve this using a recursive approach, as explained step-by-step below. We cannot delete the middle element of the stack directly because, according to the stack property, we can perform only push and pop operations on the top of the stack. Steps to Delete the Middle Element of a Stack Step 1: Determine the Position of the Middle Element, First ...
Read More