diff --git a/height/input.txt b/height/input.txt new file mode 100644 index 0000000..79475b1 --- /dev/null +++ b/height/input.txt @@ -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 \ No newline at end of file diff --git a/height/output.txt b/height/output.txt new file mode 100644 index 0000000..59b1d9d --- /dev/null +++ b/height/output.txt @@ -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 diff --git a/height/stub.dsl b/height/stub.dsl new file mode 100644 index 0000000..501f03b --- /dev/null +++ b/height/stub.dsl @@ -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 \ No newline at end of file diff --git a/height/stub.js b/height/stub.js new file mode 100644 index 0000000..dfad3dc --- /dev/null +++ b/height/stub.js @@ -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(); +}