Reverse a Number in Java.

Reverse a Number in Java.


Given a integer number, reverse it.

Lets see sample input and output for better understanding:
Reverse a number in Java input output example
Reverse a number in Java input output example

Find length of the longest valid parenthesis substring

Find length of the longest balanced parenthesis in a string.


Given a string consisting of opening and closing parenthesis, find the length of the longest balanced parenthesis in it.

Lets see sample input and output for better understanding:
count longest valid parentheses length
longest valid parentheses count

Sort a Stack using Merge Sort

Sort a Stack using Merge Sort.


Lets see how to sort a stack using merge sort which uses divide and conquer recursive algorithm.

I recommend reading Merge sort first before proceeding.
Also, check Merge sort article on linked list that will help in understanding Merge sort and this article better.

Lets see sample input and output for better understanding:
sort a stack using recursion in java
Sort a Stack using Merge Sort in Java