LeetCode daily problem 2485. Find the Pivot Integer, tricky problem, one of the ones that is simple after you find the trick, I tried a combination of prefix sum and two pointers, iterating closer to the pivot. I believe the time complexity is O(n) linear, where space is O(1) constant. Did you give it a try? Link to my solution.

https://github.com/cardosopab/LeetCodeNotes/blob/main/2485.py

#python
#pythonprogramming
#algorithms
#datastructures

LeetCodeNotes/2485.py at main · cardosopab/LeetCodeNotes

Culmination of daily LeetCode problems. Contribute to cardosopab/LeetCodeNotes development by creating an account on GitHub.

GitHub