Skip to content

Instantly share code, notes, and snippets.

@yesidays
Created April 7, 2020 17:39
Show Gist options
  • Save yesidays/3a218ddcb11a253a3fdb8a456b51b6bc to your computer and use it in GitHub Desktop.
Save yesidays/3a218ddcb11a253a3fdb8a456b51b6bc to your computer and use it in GitHub Desktop.
Couting Elements - Leetcode
class Solution(object):
def countElements(self, arr):
"""
:type arr: List[int]
:rtype: int
"""
result = 0
for j in arr:
x = j + 1
if x in arr:
result += 1
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment