We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
'usestrict';process.stdin.resume();process.stdin.setEncoding('utf-8');letinputString:string='';letinputLines:string[]=[];letcurrentLine:number=0;process.stdin.on('data',function(inputStdin:string):void{inputString+=inputStdin;});process.stdin.on('end',function():void{inputLines=inputString.split('\n');inputString='';main();});functionreadLine():string{returninputLines[currentLine++];}functionmain(){// Enter your code herewhile(readLine()){constpreviousValue=parseInt(inputLines[currentLine-1])constarr=inputLines.slice(currentLine,currentLine+previousValue)printArray(arr)currentLine+=previousValue}}functionprintArray<T>(arr:Array<T>){arr.forEach(item=>console.log(item))}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 21: Generics
You are viewing a single comment's thread. Return to all comments →
Typescript