0844_backspace-string-compare

command
v0.0.0-...-60194e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2020 License: Unlicense Imports: 0 Imported by: 0

README

0844_backspace-string-compare

直觉是模拟, 其实是对一个stack做push和pop操作.

题目提到能用O(1)的空间完成.

转换思路: 一个#代表的删除操作, 能够影响在这之前的输入记录.

从右往左, 我们维护两串记录的最后有效输入, 碰到#则表示可跳过一个输入. 具体可以看代码.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL