Then I looked at the LeetCode hint, and everything clicked. 💡 Store: Last digit Second last digit Once I had those two values available, every time I placed a new digit, I could immediately determine ...
There was an error while loading. Please reload this page.
Solution SELECT DISTINCT l1.num AS ConsecutiveNums FROM Logs l1 JOIN Logs l2 ON l1.id = l2.id - 1 JOIN Logs l3 ON l2.id = l3.id - 1 WHERE l1.num = l2.num AND l2.num = l3.num; Key Concepts ->Self Joins ...