Created
April 7, 2020 17:39
-
-
Save yesidays/3a218ddcb11a253a3fdb8a456b51b6bc to your computer and use it in GitHub Desktop.
Couting Elements - Leetcode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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