Guest User

Untitled

a guest
Feb 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. public boolean unlucky1(int[] nums) {
  2. boolean resultaat = false;
  3. for (int i = 0; i < nums.length; i++ ){
  4. if ( i < nums.length-1) {
  5.  
  6. if ( nums[i] == 1 && i <= 2 ) {
  7. if (nums[i+1] == 3 ) {
  8. resultaat = true;
  9. }
  10. }
  11. } else if (nums[i] == 3 && nums [i-1] == 1){
  12. resultaat = true;
  13. }
  14. }
  15. if (nums.length > 3 ) {
  16.  
  17. if (nums[nums.length-2] == 3){
  18. resultaat = false;
  19. }
  20. }
  21. return resultaat;
  22. }
Add Comment
Please, Sign In to add comment