Advertisement
Guest User

Untitled

a guest
May 21st, 2017
630
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. function solve(input) {
  2. let inputChecker = [];
  3. for(let i = 0; i<input.length; i++){
  4. if(input[i]){
  5. inputChecker.push(input[i]);
  6. }
  7. }
  8. inputChecker = inputChecker.map(Number);
  9. let output = [];
  10. output.push(inputChecker[0]);
  11. for(let i = 1; i < inputChecker.length; i++){
  12. if(inputChecker[i] >= output[output.length-1]){
  13. output.push(inputChecker[i]);
  14. }
  15. }
  16. for(let element of output){
  17. console.log(element);
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement