para practicar codefights

In this example below you will see how to do a para practicar codefights with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by ruthsalvadorz, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright ruthsalvadorz ©
  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>para practicar codefights</title>
  
  
  
  
  
</head>

<body>

  
  
  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/ruthsalvadorz/para-practicar-codefights-PpwXvm */
function almostIncreasingSequence(sequence) {
   for (var i=0; i<sequence.length; i++){
     if(sequence[i]>sequence [i+1]){
       sequence.splice(i,1);
       break;
       
     } 
   }
   for (var j=0; j<sequence.length; j++){
     if((sequence[j] >=sequence[j+1]) && (sequence.length >2)){
       return false;
     //} else if ((sequence[j] > sequence[j+1])){
       //return false;
     } 
   }return true;
  
 
} 
document.write("1.F "+almostIncreasingSequence([1,2,3])+ "<br>");
document.write("2.T "+almostIncreasingSequence([1, 3, 2])+ "<br>");
document.write("3.F "+almostIncreasingSequence([1, 2, 1, 2])+ "<br>");
document.write("4.F "+almostIncreasingSequence([1, 4, 10, 4, 2])+ "<br>");
document.write("5.T "+almostIncreasingSequence([10, 1, 2, 3, 4, 5])+ "<br>");
document.write("6.F "+almostIncreasingSequence([1, 1, 1, 2, 3])+ "<br>");
document.write("7.T "+almostIncreasingSequence([0, -2, 5, 6])+ "<br>");
document.write("8.F "+almostIncreasingSequence([40, 50, 60, 10, 20, 30])+ "<br>");
document.write("9.T "+almostIncreasingSequence([1,1])+ "<br>");

Comments