leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

2424.cpp (366B)


0 class LUPrefix { 1 public: 2 LUPrefix(int n) : n(n) { memset(seen, 0x00, sizeof(seen)); } 3 4 void upload(int video) { seen[video] = true; } 5 6 int longest() const { 7 while (seen[next]) 8 next++; 9 return next - 1; 10 } 11 12 private: 13 const int n; 14 mutable int next = 1; 15 16 static int seen[100001]; 17 }; 18 19 int LUPrefix::seen[100001];