Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean unlucky1(int[] nums) {
- boolean resultaat = false;
- for (int i = 0; i < nums.length; i++ ){
- if ( i < nums.length-1) {
- if ( nums[i] == 1 && i <= 2 ) {
- if (nums[i+1] == 3 ) {
- resultaat = true;
- }
- }
- } else if (nums[i] == 3 && nums [i-1] == 1){
- resultaat = true;
- }
- }
- if (nums.length > 3 ) {
- if (nums[nums.length-2] == 3){
- resultaat = false;
- }
- }
- return resultaat;
- }
Add Comment
Please, Sign In to add comment