今際の国の呵呵君
Saturday, September 30, 2017
[LeetCode]Judge Route Circle
很简单的题目,对x和y分别记录,看最后是否有位移即可。当然题目也可以变为路径上时候存在环,我们用set记录每个时刻的位置即可。对这道题来说,常数空间,Linear time即可解,代码如下:
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment