Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Python output issue #393

Open
DevonStee opened this issue Dec 28, 2024 · 0 comments
Open

[BUG] Python output issue #393

DevonStee opened this issue Dec 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@DevonStee
Copy link

My local Python environment is configured correctly, and executing other Python code works fine, but it seems to enter an infinite loop when executing this code.

class Solution:
  def getPairsCount(self, process: List[int], k: int) -> int:
    ans = 0
    n = len(process)
    process.sort()
    j = 0
    for i in range(n):
      while j < n:
        if process[j] - process[i] <= k:
          j += 1

        else:
          ans += j - i
          break
    return ans

a = Solution()
process = [100, 200, 300, 400]
k = 250
print(a.getPairsCount(process,k))
Screenshot 2024-12-28 at 6 19 55 PM
@DevonStee DevonStee added the bug Something isn't working label Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant