Skip to content

Added height #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions height/input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
4
1
900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919
2
919 918 917 916 915 914 913 912 911 910 909 908 907 906 905 904 903 902 901 900
3
901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 900
4
918 917 916 915 914 913 912 911 910 909 908 907 906 905 904 903 902 901 900 919
88 changes: 88 additions & 0 deletions height/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
[ 1,
900,
901,
902,
903,
904,
905,
906,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
919 ]
1 4
[ 2,
919,
918,
917,
916,
915,
914,
913,
912,
911,
910,
909,
908,
907,
906,
905,
904,
903,
902,
901,
900 ]
2 4
[ 3,
901,
902,
903,
904,
905,
906,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
919,
900 ]
3 4
[ 4,
918,
917,
916,
915,
914,
913,
912,
911,
910,
909,
908,
907,
906,
905,
904,
903,
902,
901,
900,
919 ]
4 4
8 changes: 8 additions & 0 deletions height/stub.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function(integer_array, findStepBacks, integer K, integer_array students)
integer(P)
loop(P)
integer(K)
array(integer, students, 20, single)
invoke(integer_array, steps, findStepBacks, K, students)
print(integer_array, steps, \n)
endloop
59 changes: 59 additions & 0 deletions height/stub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use strict';

const fs = require('fs');

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', function(inputStdin) {
inputString += inputStdin;
});

process.stdin.on('end', function() {
inputString = inputString.split('\n');

main();
});

function readLine() {
return inputString[currentLine++];
}

/*
* Complete the 'findStepBacks' function below.
*
* The function is expected to return an INTEGER_ARRAY.
* The function accepts following parameters:
* 1. INTEGER K
* 2. INTEGER_ARRAY students
*/

function findStepBacks(K, students) {
// Write your code here

console.log(K)
console.log(students)
let steps = [K, 4]
return steps
}

function main() {
const ws = process.stdout;

const P = parseInt(readLine().trim(), 10);

for (let PItr = 0; PItr < P; PItr++) {
const K = parseInt(readLine().trim(), 10);

const students = readLine().replace(/\s+$/g, '').split(' ').map(studentsTemp => parseInt(studentsTemp, 10));

const steps = findStepBacks(K, students);

ws.write(steps.join('\n') + '\n');
}

ws.end();
}