Answers to LeetCode questions in Swift 3
Started primarily for a few reasons:
- First and foremost, Swift is really cool and fun to use! (update: a few files in, beginning to second guess this...)
- I felt like I was becoming too complacent with Python for interviews, work, projects, etc.
- It's helpful to have a central repository for studying when the time comes.
- Similarly, Python provides shortcuts that might hurt algorithmic thought processes that, if existing in Swift, I have not been exposed to.
- Swift is new to LeetCode (as of early/mid 2017), so even if I want to cheat and look at submissions, usually all I can get is the ideas and not the source code.
Hope to keep this as a running repository as I continue to work on algorithms, feel free to PR with your own solutions if you'd like!
Currently included:
- 1. Two Sum
- 2. Add Two Numbers
- 3. Longest Substring Without Repeating Characters*
- 4. Median of Two Sorted Arrays
- 206. Reverse Linked List
- 617. Merge Two Binary Trees
* This one feels especially dirty with the need to encode Strings as Arrays of UTF-8 bits to iterate efficiently. If anyone has ideas for handling this better, please PR it! Stack Overflow and the LeetCode forums can only help so much ๐