diff --git a/Adding a new problem in the list b/Adding a new problem in the list new file mode 100644 index 00000000..613f8325 --- /dev/null +++ b/Adding a new problem in the list @@ -0,0 +1,25 @@ +/* +Submitted by: Vaibhav Agarwal https://github.com/vacodr +Problem: https://leetcode.com/problems/number-of-recent-calls/ +Difficulty: Easy +*/ + +class RecentCounter { + Queue time = new LinkedList(); + public RecentCounter() { + + } + + public int ping(int t) { + time.add(t); + + while (time.peek() < t - 3000) { + + //System.out.printf(time.peek()+" "); + + time.poll(); + } + return time.size(); + } + +}