美文网首页
219. Contains Duplicate II

219. Contains Duplicate II

作者: BeijingIamback | 来源:发表于2016-04-07 22:58 被阅读8次

    Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k.

    定义一个hash表,存储 数字 和 对应的index。

    相关文章

      网友评论

          本文标题:219. Contains Duplicate II

          本文链接:https://www.haomeiwen.com/subject/bkhvlttx.html