Skip to content

Commit

Permalink
add so
Browse files Browse the repository at this point in the history
  • Loading branch information
ductnn committed Dec 16, 2023
1 parent 2ffe6a5 commit 3bb9ea2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions leetcode/design/933.NumberOfRecentCalls/numberOfRecentCalls.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

type RecentCounter struct {
q []int
}

func Constructor() RecentCounter {
return RecentCounter{[]int{}}
}

func (this *RecentCounter) Ping(t int) int {
this.q = append(this.q, t)
for this.q[0] < t-3000 {
this.q = this.q[1:]
}
return len(this.q)
}

/**
* Your RecentCounter object will be instantiated and called as such:
* obj := Constructor();
* param_1 := obj.Ping(t);
*/

0 comments on commit 3bb9ea2

Please sign in to comment.