Hackerrank 30 days of code Java Solution: Day 20: Sorting

Hackerrank Day 20: In this problem we have to implement a sorting algorithm. Sorting is arranging of data based on some condition. Mostly data is arranged in ascending or descending order. We have lot of sorting techniques like quick sort , merge sort, bubble sort , insertion sort , selection sort etc.
We can use any sorting technique in this problem.

Lets find out the solution of : Day 20


Given an array, a, of size n distinct elements, sort the array in ascending order using the Bubble Sort algorithm above

Sample Input

Sample Output

Solution to the problem is :

Thanks for the visit checkout the day 21 tutorial as well.. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *