- Introduction to Challenges
- Insertion Sort 1
- Insertion Sort Itself
- Correctness and the Loop Invariant
- Running Time
-
Counting Sort 1 - Simple Counting Sort
- Prepare for Full Counting Sort
- The Full Counting Sort
-
QuickSort1 - Simple Quick Sort
- Quick-Sort Advanced
- Quick Sort Running Time
Input Format for standard Sorting Challenges:
- t - the number of test cases
- s - the size of the array
- ar - the list of integers
Introduction to Challenges
These challenges will have a similar input format, which will come in on the Standard Input (STDIN). You need to print your solution to the Standard Output (STDOUT).
You will be provided with boilerplate code which processes the input into arrays and passed them to the method doStuff
. To reload the boilerplate, you can click on "Reset Code" below.
Sample Challenge.
This is a simple challenge to get used to the interface. For each list of numbers you are given as input can you output the sum of the list?
Input
The input for these challenges will follow the format summarized in the sidebar. The first line will contain T, the number of test cases. Each test case will contain 2 lines:
N - the number of elements in a list.
N numbers will follow.
Output
Output the sum of each list of integers on its own line.
Challenge
Output the sum of each line of numbers in the input.
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.
Comments
Bolke
Jul 30, 3:57 PMI utterly & completely do not understand how to deal with the input here.
Could one please see an example in code?
I notice my comments haven't been answered, lately, but I really would like this one answered, because I can't move on. Thanks.
Learneroo
Jul 31, 5:26 PMHere's a simple solution to this problem: my code. You just need to print the sum of each list of numbers.
Bolke
Jul 31, 5:56 PMWell it's not actually the solution I was after, but the input method. It says:
The input for these challenges will follow the format summarized in the sidebar.
Then in the sidebar I see:
Input Format for standard Sorting Challenges:
But on the other hand:
Each test case will contain 2 lines:
N - the number of elements in a list.
N numbers will follow.
Should we construct a Scanner object and take input from that? I really don't follow.