pub struct Solution;
Expand description
DFA
enum
+ Pattern Matching 实现状态机,再加上 Iterator
/Result
的高阶函数组合工具,
代码可读性比写个表找下标不知道高哪里去了。
另外,开始不需要 trim()
,一是因为这个操作结合起来整个实现并没有这里的实现高效,
二是内部调用了 char:is_whitespace()
不止判断了空格,还有其它空白字符,不一定符合题目的测试用例。
Implementations§
Auto Trait Implementations§
impl Freeze for Solution
impl RefUnwindSafe for Solution
impl Send for Solution
impl Sync for Solution
impl Unpin for Solution
impl UnwindSafe for Solution
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more