MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / add

Method add

KthLargestElementInAStream.java:12–20  ·  view source on GitHub ↗
(int val)

Source from the content-addressed store, hash-verified

10 }
11
12 public int add(int val) {
13 if(pq.size()<k || val > pq.peek()){
14 pq.offer(val);
15 if(pq.size()>k){
16 pq.poll();
17 }
18 }
19 return pq.peek();
20 }
21}
22
23/**

Callers 15

KthLargestMethod · 0.95
wordSubsetsMethod · 0.45
inorderMethod · 0.45
inorderTraversalMethod · 0.45
checkIfPrerequisiteMethod · 0.45
preorderTraversalMethod · 0.45
dfsMethod · 0.45
levelOrderMethod · 0.45
eventualSafeNodesMethod · 0.45
equationsPossibleMethod · 0.45
solveMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected