Rust果然比較複雜,在經歷了n次compile fail,終于寫成了一個 list 難點: 對Rc<>的用法不熟悉。對borrow checker不夠熟悉 有些寫法可能還不是最短的 ...
分类:
其他好文 时间:
2019-09-04 15:09:46
阅读次数:
87
题目描述 Implement atoi which?converts a string to an integer. The function first discards as many whitespace characters as necessary until the first non ...
分类:
其他好文 时间:
2019-09-01 21:59:41
阅读次数:
105
Reverse a singly linked list. Example: Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both? 思路: 重塑链表, ...
分类:
其他好文 时间:
2019-08-29 16:13:39
阅读次数:
92
In an election, the th?vote was cast for at time . Now, we would like to implement the following query function: will return the number of the person ...
分类:
其他好文 时间:
2019-08-28 00:56:16
阅读次数:
110
Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in front ...
分类:
其他好文 时间:
2019-08-27 10:52:01
阅读次数:
80
Problem Statement Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Implement an i ...
分类:
其他好文 时间:
2019-08-24 10:00:09
阅读次数:
94
1.编写用来获取数据的接口 public interface DataBase{ //改方法用来获取数据 public void getData(); } 2.编写具体负责获取数据的类 public class SqlDataBase1 implement DataBase{ //该方法1用来获取数 ...
分类:
编程语言 时间:
2019-08-22 14:42:08
阅读次数:
83
题目: 实现 strStr() 函数。 给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始)。如果不存在,则返回 -1。 示例 1: 输入: haystack = "hello", needle = " ...
分类:
其他好文 时间:
2019-08-20 01:22:10
阅读次数:
86
题目:实现一个字典树 注: 使用字典结构来存储,每层都是一个字典,存储此层所有的元素(包括字典)。每个元素存储方式也为一个字典,key为字符和一个标记end_of_word,表示该字符是否为一个单词的结束。插入操作时,遍历要插入词的每个字符,如果在字典树中找不到,则将该字符插入字典树,默认值为{}, ...
分类:
其他好文 时间:
2019-08-19 23:14:29
阅读次数:
86
Problem Statement Implement a basic calculator to evaluate a simple expression string. Implement a basic calculator to evaluate a simple expression st ...
分类:
其他好文 时间:
2019-08-19 13:17:04
阅读次数:
67