Skip to content

homework 1.2 solution#174

Open
tkhambir wants to merge 2 commits into
mate-academy:masterfrom
tkhambir:hw-1.2
Open

homework 1.2 solution#174
tkhambir wants to merge 2 commits into
mate-academy:masterfrom
tkhambir:hw-1.2

Conversation

@tkhambir

Copy link
Copy Markdown

No description provided.

*/
public boolean booleanExpression(boolean a, boolean b, boolean c, boolean d) {
return false;
return (a & b & !c & !d) | (a & c & !b & !d)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start, but try to think how you can make solution less complicated.
Hint:

  • you can use fewer boolean operations (read smth about XOR operation)

*/
public boolean booleanExpression(boolean a, boolean b, boolean c, boolean d) {
return false;
return (a & b & !c & !d) | (a & c & !b & !d)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the difference between & and &&?

- redundant statements excluded
@tkhambir tkhambir requested a review from Sofasmile July 27, 2020 16:56

@Sofasmile Sofasmile left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants