Skip to content

Commit

Permalink
Update Challenge.java
Browse files Browse the repository at this point in the history
  • Loading branch information
VacancyIF authored Nov 23, 2023
1 parent 4abe6d1 commit dd5bbb3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/com/bytelegend/Challenge.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static void main(String[] args) {
* (`+`).
*/
public static int multiplyBy31(int n) {
return 0;
return (n << 5) - n;
}

/**
Expand All @@ -32,6 +32,10 @@ public static int multiplyBy31(int n) {
* addition sign (`+`).
*/
public static int divideBy2ThenMinus1(int n) {
return 0;
if (n < 0) {
int m = -n;
return -(m >> 1) - 1;
}
return (n >> 1) - 1;
}
}

0 comments on commit dd5bbb3

Please sign in to comment.