Bubble Sort

3.5

15 votes
Very-Easy
Problem

You have been given an array A of size N . you need to sort this array non-decreasing oder using bubble sort. However, you do not need to print the sorted array . You just need to print the number of swaps required to sort this array using bubble sort

Input Format

The first line consists of a single integer N denoting size of the array. The next line contains N space separated integers denoting the elements of the array.

Output Format Print the required answer in a single line

Constrains 1N100

1a[i]100

Sample Input
5
1 2 3 4 5
Sample Output
0
Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?