You are viewing a single comment's thread. Return to all comments →
Javascript
let queries=input.split('\n') queries.splice(0,1) let arr=[] let min=null; for(let query of queries){ query=query.split(' ') let op=query[0] let param=query[1] if(op=='1'){ arr.push(param) if(parseFloat(param)<parseFloat(min)){ min=param }else if(min===null){ min=param } } if(op=='3'){ console.log(min) } if(op=='2'){ arr.splice(arr.indexOf(param),1) if(min==param){ min=Math.min(...arr) } } }
Seems like cookies are disabled on this browser, please enable them to open this website
QHEAP1
You are viewing a single comment's thread. Return to all comments →
Javascript