Skip to content

Commit

Permalink
Revert "OK (#127)"
Browse files Browse the repository at this point in the history
This reverts 161fea0.
  • Loading branch information
ByteLegendBot committed Nov 28, 2023
1 parent 161fea0 commit 425358b
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/main/java/com/bytelegend/Challenge.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,18 @@
public class Challenge {
public static void main(String[] args) {
System.out.println(firstOrNull(new Object[0]));
System.out.println(firstOrNull(new Object[]{1}));
System.out.println(firstOrNull(new Object[]{"a", "b", "c"}));
System.out.println(firstOrNull(new Object[] {1}));
System.out.println(firstOrNull(new Object[] {"a", "b", "c"}));
System.out.println(lastOrNull(new Object[0]));
System.out.println(lastOrNull(new Object[]{1}));
System.out.println(lastOrNull(new Object[]{"a", "b", "c"}));
System.out.println(lastOrNull(new Object[] {1}));
System.out.println(lastOrNull(new Object[] {"a", "b", "c"}));
}

public static Object firstOrNull(Object[] array) {
if (array.length == 0)
return null;
return array[0];
return array[1];
}

public static Object lastOrNull(Object[] array) {
if (array.length == 0)
return null;
return array[array.length - 1];
return array[array.length];
}
}

0 comments on commit 425358b

Please sign in to comment.