Why I Switched to Problem Solving with Python—and Why You Should Too!

Why I decided to stop using Java and use Python instead

Background

Since I started Leetcode I’ve been using Java for problem solving. I was primarily drawn to its explicit data structure definitions. Understanding essential concepts like ArrayLists, LinkedLists, PriorityQueues, HashMaps, or HashSets was a crucial step before effectively utilizing them. This approach significantly increased my comprehension of data structures. Moreover, the widespread adoption of Java by others in the LeetCode community influenced my initial choice.

Why Java became inconvenient

My challenges began when I found myself occasionally needing to look up syntax for initializing less commonly encountered data structures while navigating through LeetCode problems. Since Java wasn’t part of my everyday programming outside of LeetCode, I tended to forget some of the less frequently used Java boilerplate. Consequently, a considerable portion of my mental energy was spent on syntax searches, diverting my attention from the core problem-solving task.

It dawned on me that once I grasped the nuances of these specific data structures and their use cases, transitioning to Python would be a pragmatic move. In Python, a simple list, with its straightforward syntax, seamlessly assumes the roles of an array, ArrayList, stack, queue, and more. This shift allowed me to identify the underlying data structure in use and articulate it confidently during interviews, all the while avoiding the encumbrance of verbose syntax and enabling me to concentrate fully on solving the problems at hand.

Subscribe to the Newsletter

Subscribe to get my latest content by email.

    I won't spam you.

    Unsubscribe at any time.