Optimize and_gate and nand_gate (#10591)

* Added more optimized sudoku solver algorithm

* Added more optimized sudoku solver algorithm and File Renamed

* and_gate is Optimized

* and_gate is Optimized

* and_gate is Optimized

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Sandeepa Dilshan Alagiyawanna 2023-10-17 04:47:49 +05:30 committed by GitHub
parent fcea18c9f0
commit 5f629b6049
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ def and_gate(input_1: int, input_2: int) -> int:
>>> and_gate(1, 1)
1
"""
return int((input_1, input_2).count(0) == 0)
return int(input_1 and input_2)
if __name__ == "__main__":

View File

@ -27,7 +27,7 @@ def nand_gate(input_1: int, input_2: int) -> int:
>>> nand_gate(1, 1)
0
"""
return int((input_1, input_2).count(0) != 0)
return int(not (input_1 and input_2))
if __name__ == "__main__":