Skip to content

Commit

Permalink
Create leetflex-banned-accounts.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 authored Feb 7, 2021
1 parent d6c85a6 commit 04125ad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions MySQL/leetflex-banned-accounts.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Time: O(n^2)
# Space: O(n)

SELECT DISTINCT l1.account_id
FROM loginfo l1
INNER JOIN loginfo l2
ON l1.account_id = l2.account_id
AND l1.ip_address != l2.ip_address
WHERE NOT (l1.login > l2.logout
OR l1.logout < l2.login);

0 comments on commit 04125ad

Please sign in to comment.