Turbo Sort Codechef Solution

Hello Programmers In this post, you will know how to solve the Turbo Sort Codechef Solution.

Turbo Sort Codechef Solution
Turbo Sort Codechef Solutions

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Codechef by yourself. If you find any difficulty after trying several times, then you can look for solutions.

Problem

Given the list of numbers, you are to sort them in non decreasing order.

Input

t – the number of numbers in list, then t lines follow [t <= 10^6].

Each line contains one integer: N [0 <= N <= 10^6]

Output

Output given numbers in non decreasing order.

Example

Input:

5
5
3
6
7
1

Output:

1
3
5
6
7

Turbo Sort CodeChef Solutions in Python

N = int(input())
l = []
for N in range(N):
    l.append(int(input()))
Result = sorted(l)
for R in Result:
    print(R)   

Turbo Sort CodeChef Solutions in CPP

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int t ;
    cin >> t;
    vector<int>v;
    while(t--){
    int n;
    cin >> n;
    v.push_back(n);
    }
    sort(v.begin(),v.end());
    for(int x=0;x<v.size();x++)
        cout << v[x] << '\n';
    }

Turbo Sort CodeChef Solutions in JAVA

import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++)
         a[i]=sc.nextInt();
        Arrays.sort(a);
        for(int i=0;i<n;i++)
         System.out.println(a[i]);
    }
}
Ezoicreport this ad

Disclaimer: The above Problem (Turbo Sort) is generated by CodeChef but the solution is provided by BrokenProgrammers. This tutorial is only for Educational and Learning purpose.

Note:- I compile all programs, if there is any case program is not working and showing an error please let me know in the comment section. If you are using adblocker, please disable adblocker because some functions of the site may not work correctly.

Next: Small Factorials Codechef Solution

Sharing Is Caring

Leave a Comment

Ezoicreport this ad