All Tracks Algorithms Sorting Bubble Sort Problem

Bubble Sort
/

Algorithms, Basic Programming, Bubble Sort, Input/Output, Sorting

Problem
Editorial
Analytics

You are given arrays \(a_1, a_2, …, a_n\). 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\) (\(1 ⩽ N ⩽ 5000\)) denoting the number of elements of array \(A\).
  • The second line contains \(N\) positive integers (\(1 ⩽ A_i ⩽ N\)) 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)

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

This Problem was Asked in

Initializing Code Editor...
Notifications
View All Notifications

?