## Check for Balanced Parentheses using Stack – Java Code

Write a java code to check for balanced parentheses using stack. Given an expression containing characters ‘{‘,’}’,'(‘,’)’,'[‘,’]’. We have to write a java code to check whether an input string has valid parentheses.

An input string is valid if:

Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.

Example –

i) {[]}) – Invalid
ii) {()}[] – Valid

## Java Program to Calculate Power of a Number

In this tutorial, I am going to explain how to calculate power of a number without using Math.pow method in java.

For example:

i) 23 = 8 (2 * 2 * 2)
ii) 52 = 25 (5 * 5)

Subscribe Our Tutorials

## Find Second Smallest Number in an Array : Java Code

Write a java program to find second smallest number in an array. Given an input array, write a java code to print second smallest number of an array.

For example :

arr = {-1, 7, 1, 34, 18}

The second smallest number in this array is 1.

## Binary Search in PHP : Explain with Code Examples

Write a program to implement binary search in PHP. Given a sorted array, we have to write a PHP code to search an element using binary search algorithm.

## Foreign Key in Mysql : How to Create a Foreign Key in Mysql

How to create a Foreign key in MySql. What’s the use of Foreign key constraint in a MySql. In this tutorial, You’ll learn about Foreign key constraint and it’s advantages.

## PHP Code to Check Whether a Number is Palindrome or Not

Write a PHP code to check whether a number is palindrome or not. In this tutorial, we are going to write a PHP program to check whether an input number is palindrome or not.

## Swap Two Numbers in PHP – Explain with Code Examples

Write a PHP script to swap two numbers. In this tutorial, we are going to write a code to swap two numbers in PHP.

There are multiple approaches by which you can swap two numbers.

i) We can swap two numbers using third or temp variable.

ii) We can swap two numbers without using third variable.