This file contains 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
fn main() { | |
println!("{}", factorial(4)); | |
} | |
// Using Recursion | |
// fn factorial(n: usize) -> usize { | |
// if( n == 0) { | |
// return 1; | |
// } else { | |
// return factorial(n-1) * n; |
This file contains 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
fn main() { | |
println!("{}", fibonacci(7)); | |
} | |
// Using Recursion | |
// fn fibonacci(n: usize) -> usize { | |
// if (n < 2) { | |
// return n; | |
// } |
This file contains 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
// Iteration | |
function fibonacci(n) { | |
const fib = [0, 1]; | |
for (let i = 2; i <= n; i++) { | |
fib[i] = fib[i - 1] + fib[i - 2]; | |
} | |
// const fibb = { | |
// fibonacci: fib, |
This file contains 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
use std::collections::HashSet; | |
use rand::Rng; | |
fn power_set(set: &Vec<i32>) -> Vec<Vec<i32>> { | |
let mut result = Vec::new(); | |
let size = set.len(); | |
let no_of_subsets = 1 << size; | |
for i in 0..no_of_subsets { | |
let mut subset = Vec::new(); |
This file contains 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
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity ^0.8.24; | |
contract MultiSig { | |
address owner; | |
address[] signers; | |
uint256 quorum; | |
uint256 txCount; | |
address nextOwner; |
This file contains 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 { | |
time, | |
loadFixture, | |
} from "@nomicfoundation/hardhat-toolbox/network-helpers"; | |
import { anyValue } from "@nomicfoundation/hardhat-chai-matchers/withArgs"; | |
import { expect } from "chai"; | |
import { ethers } from "hardhat"; | |
describe("Lock", function () { | |
// We define a fixture to reuse the same setup in every test. |
This file contains 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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract SaveEther { | |
mapping(address => uint256) savings; | |
event SavingSuccessful(address indexed user, uint256 indexed amount); | |
function deposit() external payable { | |
require(msg.sender != address(0), "wrong EOA"); |
This file contains 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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.4; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
contract HooziNFT is ERC721, Ownable { | |
constructor() ERC721("HooziNFT", "HOZ") Ownable(msg.sender) {} | |
function safeMint(address to, uint256 tokenId) public onlyOwner { |
This file contains 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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.4; | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; | |
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; | |
contract FractionalNft is ERC20, Ownable, ERC20Permit, ERC721Holder { | |
IERC721 public collection; |
This file contains 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
{ | |
"message": "Completed Successfully", | |
"status": true, | |
"data": { | |
"banks": [ | |
{ | |
"bankCode": "090267", | |
"bankName": "Kuda." | |
}, | |
{ |
NewerOlder