Swift Packages For LeetCode

Rahul Goel
May 21, 2024

--

Want to solve LC Medium or LC Hard in less time which require you to use complex data structure?

Problem : Swift does not provide heap, queue, stack and other complex DS as part of their framework.

Solution 1: Create your own DS as part of problem every time and use, but this would take a lot of time and would change focus from real problem.

Solution 2: Use apple provided package for collections that has Heap and other DS.

Leetcode by default support Collections, just import and use that’s all.

Using Heap

References: https://github.com/apple/swift-collections

Follow me Rahul Goel for further updates.

--

--

Rahul Goel

Computer Science Enthusiast | 11+ Year of Software Evolution | @Sharechat, Groupon, Paytm, Myntra https://www.linkedin.com/in/therahulgoel/