Ayush Mishra’s Post

0ms. 100% Beats. Thinking outside the box. There is nothing quite like the feeling of seeing your code hit a 0ms runtime. Today’s win was the "Delete Node in a Linked List" problem. At first glance, it feels impossible—how do you delete a node when you don't have access to the head of the list? The Solution: Instead of trying to "delete" the node in the traditional sense, I just copied the data from the next node into the current one and skipped the next node entirely. The Result: * Runtime: 0ms (Beats 100.00% of Java users). * Logic: O(1) Time and Space complexity. * Efficiency: 41/41 test cases passed instantly. In software engineering, we often get stuck trying to solve a problem the "standard" way. This was a great reminder that sometimes, the best solution is to reframe the problem itself. One optimization at a time. Do you prefer clever "hacks" like this, or do you stick to standard procedural logic? Let’s discuss in the comments! 👇 #Java #LeetCode #SoftwareEngineering #CodingLife #DataStructures #Optimization #TechCommunity

  • graphical user interface, text, application

Smart way of thinking—this is a great example of solving the problem by changing how you look at it

To view or add a comment, sign in

Explore content categories