上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 79 下一页
摘要: /** 208. Implement Trie (Prefix Tree) https://leetcode.com/problems/implement-trie-prefix-tree/description/ A trie (pronounced as "try") or prefix tre 阅读全文
posted @ 2022-05-25 19:00 johnny_zhao 阅读(58) 评论(0) 推荐(0) 编辑
摘要: 问题: 添加自定义pallet到Substrate框架中,编译时遇到如下错误: stderr Compiling pallet-simple-pallet v4.0.0-dev (/Users/johnny/Documents/work/BlockChain/Substrate/substrate- 阅读全文
posted @ 2022-05-01 21:16 johnny_zhao 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 观看学习视频 阅读全文
posted @ 2022-04-26 11:26 johnny_zhao 阅读(54) 评论(0) 推荐(0) 编辑
摘要: use std::borrow::Borrow; /** 21. Merge Two Sorted Lists https://leetcode.com/problems/merge-two-sorted-lists/ You are given the heads of two sorted li 阅读全文
posted @ 2022-03-17 11:22 johnny_zhao 阅读(51) 评论(0) 推荐(0) 编辑
摘要: use std::collections::{HashMap, HashSet}; /** 997. Find the Town Judge https://leetcode.com/problems/find-the-town-judge/ In a town, there are n peopl 阅读全文
posted @ 2022-03-16 00:47 johnny_zhao 阅读(29) 评论(0) 推荐(0) 编辑
摘要: use std::collections::HashSet; use std::collections::VecDeque; /** 841. Keys and Rooms https://leetcode.com/problems/keys-and-rooms/ There are n rooms 阅读全文
posted @ 2022-03-13 00:48 johnny_zhao 阅读(39) 评论(0) 推荐(0) 编辑
摘要: Rust的所有权机制,要求一个资源同一时刻有且只能有一个拥有所有权的绑定或&mut引用,目的为保证内存的安全。在大多数情况下,都没有问题,但是考虑以下情况: 在图数据结构中,多个边可能会拥有同一个节点,该节点直到没有边指向它时,才应该被释放清理。 在多线程中,多个线程可能会持有同一个数据,但是你受限 阅读全文
posted @ 2022-02-22 23:15 johnny_zhao 阅读(1809) 评论(0) 推荐(0) 编辑
摘要: use std::borrow::Borrow; use std::cell::RefCell; use std::collections; use std::collections::HashMap; use std::rc::Rc; /** 652. Find Duplicate Subtree 阅读全文
posted @ 2022-02-21 20:03 johnny_zhao 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 我们在学习Rust的借用,引用时,会遇到References(引用)、borrowing(借用)、&关键字、*关键字,他们之间的关系非常困惑。 所有权不仅可以转移(原变量会丢失数据的所有权),还可以通过引用的方式来借用数据的所有权(borrow ownership)。 我们整理下相关问题: 1. & 阅读全文
posted @ 2022-02-19 18:08 johnny_zhao 阅读(445) 评论(0) 推荐(0) 编辑
摘要: 简单工厂模式 trait Login { fn verify(&self, name: String, password: String) -> bool; } enum LoginType { Domain, Password, } struct DomainLogin {} impl Login 阅读全文
posted @ 2022-02-16 17:10 johnny_zhao 阅读(127) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 79 下一页