Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My way of doing this #5

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions java/logic-2/makeBricks.java
Original file line number Diff line number Diff line change
@@ -2,8 +2,20 @@
* of small bricks (1 inch each) and big bricks (5 inches each). Return true
* if it is possible to make the goal by choosing from the given bricks.
*/
public boolean makeBricks(int small, int big, int goal) {
int remainder = goal >= (5 * big) ? goal - (5 * big) : goal % 5;

return small >= remainder;
public int loneSum(int a, int b, int c) {
if (a == b && b == c && a == c) {
return 0;
}
else if (a == b) {
return c;
}
else if (b == c) {
return a;
}
else if (a == c) {
return b;
}
else {
return a + b + c;
}
}