Bubble Sort

You are given arrays a1,a2,,an. What will return the next function Bubble Sort (A) in the next picture.

Link to the image: https://ibb.co/vzFR5kr
Input format
  • The first line contains the integer N (1N5000) denoting the number of elements of array A.
  • The second line contains N positive integers (1AiN) denoting the elements of the array.
    Note: It is guaranteed that all elements of array A are different.
Output format
Print an integer that denotes the answer to the question.
SAMPLE INPUT
5
1 3 2 5 4
SAMPLE OUTPUT
2

Explanation
Answer is 2 (to verify this, you can simply implement this procedure)

Comments

Popular posts from this blog

How to pass parameters in webhook?

Access and modify all the resources of our Wiki.js using WikiJS API

Fahrenheit to Celsius