Skip to content

Latest commit

 

History

History
15 lines (9 loc) · 451 Bytes

README.md

File metadata and controls

15 lines (9 loc) · 451 Bytes

Idea

  1. Brute Force

quite easy to think of, time limit exceed

  1. Hash Table

we build up a hash table where

dic[current number] = current location

Since we don't really care about the pervious locations since it does not satisfy the condtion. when the next element is in the hash table, we just compare previous location and current location to make sure whether current location - previous location <= k.