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 { | |
| 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 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
| // SPDX-License-Identifier: UNLICENSED | |
| pragma solidity ^0.8.24; | |
| contract MultiSig { | |
| address owner; | |
| address[] signers; | |
| uint256 quorum; | |
| uint256 txCount; | |
| address nextOwner; |
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
| 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 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
| // 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 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
| fn main() { | |
| println!("{}", fibonacci(7)); | |
| } | |
| // Using Recursion | |
| // fn fibonacci(n: usize) -> usize { | |
| // if (n < 2) { | |
| // return n; | |
| // } |
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
| fn main() { | |
| println!("{}", factorial(4)); | |
| } | |
| // Using Recursion | |
| // fn factorial(n: usize) -> usize { | |
| // if( n == 0) { | |
| // return 1; | |
| // } else { | |
| // return factorial(n-1) * n; |
OlderNewer