This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pragma solidity >=0.4.22 <0.6.0; | |
| import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol"; | |
| import "./BlockZooContest.sol"; | |
| contract BlockZoo is IERC721, BlockZooBreeding { | |
| // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` | |
| bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; | |
| bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pragma solidity >=0.4.22 <0.6.0; | |
| import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol"; | |
| import "./BlockZooContest.sol"; | |
| contract BlockZoo is IERC721, BlockZooBreeding { | |
| // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` | |
| bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; | |
| bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pragma solidity >=0.4.22 <0.6.0; | |
| import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol"; | |
| import "./BlockZooContest.sol"; | |
| contract BlockZoo is IERC721, BlockZooBreeding { | |
| // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` | |
| bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; | |
| bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pragma solidity >=0.4.22 <0.6.0; | |
| import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol"; | |
| import "./BlockZooContest.sol"; | |
| contract BlockZoo is IERC721, BlockZooBreeding { | |
| // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` | |
| bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; | |
| bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pragma solidity >=0.4.22 <0.6.0; | |
| // import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/introspection/ERC165.sol"; | |
| import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol"; | |
| // import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/IERC721.sol"; | |
| import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol"; | |
| import "./BlockZoo.sol"; | |
| import "./IERC721.sol"; | |
| contract BlockZoo is IERC721, BlockZooBase { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import sqrt, floor | |
| LIMIT = 1_00_000_000 | |
| sqrt_limit = floor(sqrt(LIMIT)) | |
| def palindrome(num): | |
| str_num = str(num) | |
| if str_num == str_num[::-1]: | |
| return True | |
| return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import sqrt, floor | |
| LIMIT = 1_00_000_000 | |
| sqrt_limit = floor(sqrt(LIMIT)) | |
| # Checks if a number is a palindrome | |
| def palindrome(num): | |
| str_num = str(num) | |
| if str_num == str_num[::-1]: | |
| return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import sqrt, floor | |
| LIMIT = 1_00_000_000 | |
| sqrt_limit = floor(sqrt(LIMIT)) | |
| # Our resultant sum | |
| result_sum = 0 | |
| for start_num in range(1, sqrt_limit): | |
| temp_sum = start_num ** 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import sqrt, floor | |
| # We can use underscores to separate sections in a number, | |
| # they are ignored | |
| LIMIT = 1_00_000_000 | |
| # We use floor because sqrt() returns a float, and so that | |
| # this code can be generally applied to any limit | |
| sqrt_limit = floor(sqrt(LIMIT)) | |
| # Loop through starting integers | |
| for start_num in range(1, sqrt_limit): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import timeit | |
| def make_setup_string(num): | |
| string = "import efficient_fibonacci as fib\n" | |
| string += f"num = {num}" | |
| return string | |
| def main(): | |
| print("\nLinear testing started") |
NewerOlder