Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let array = gets().split(' ').map(Number);
- let isWaveForm = false;
- for(let i = 1; i <= array.length; i+=2){
- let currentNum = array[i];
- let previousNum = array[i-1];
- let nextNum = array[i+1];
- if(currentNum >= previousNum || currentNum >= nextNum){
- isWaveForm = true;
- }else{
- isWaveForm = false;
- }
- }
- if(!isWaveForm){
- console.log('yes');
- }else{
- console.log('no');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement