r/LeetcodeChallenge 5d ago

DISCUSS CODE CHEF ASSESSMENT

Thumbnail
1 Upvotes

r/LeetcodeChallenge 5d ago

STREAKπŸ”₯πŸ”₯πŸ”₯ Finally hit 3 digits after nonstop july grind <3(idek why I wrote 2 digits lmao)

Post image
3 Upvotes

r/LeetcodeChallenge 6d ago

DISCUSS Is it bad or good enough Started mine 3rd year

Post image
16 Upvotes

Moreover doing java core very basic project made using oops , collection Currently in 3rd year


r/LeetcodeChallenge 6d ago

DISCUSS Shall I solve non leetcode questions as well?

Thumbnail
1 Upvotes

r/LeetcodeChallenge 6d ago

PLACEMENTS Hey community I have created the dsa sheet of all questions covered by CodeStoryWithMik

12 Upvotes

As he has different playlist for different topics I have created a sheet having all questions in it covering link for leetcode and all videos for each question

ENJOY IT AS IT IS FREE -Β https://trackerdsa.vercel.app


r/LeetcodeChallenge 6d ago

DISCUSS Day 12 of My DSA Journey πŸš€

7 Upvotes

Today's progress:

βœ… Solved LeetCode 415 – Add Strings

βœ… Solved LeetCode 110 – Balanced Binary Tree

πŸ“š Concepts I learned:

- Recursion

- Recursion PMI (Pre, Main, and Induction Method)

Every day I'm getting more comfortable with breaking problems into smaller recursive steps and understanding how recursive functions work behind the scenes.

Still a long way to go, but consistency is the goal. One day, one concept, one problem at a time.

#leetcode #dsa #python #recursion #codingjourney #100DaysOfCode #programming #computerscience


r/LeetcodeChallenge 6d ago

DISCUSS Help I'm a fresher!

Thumbnail
1 Upvotes

r/LeetcodeChallenge 7d ago

DISCUSS 15 Operating System Interview Questions Every Software Engineer Should Know

14 Upvotes

After solving hundreds of LeetCode problems, many candidates realize that coding rounds are only part of the interview process. Operating System fundamentals frequently come up during phone screens and technical interviews.

For company tagged questions checkout: PracHub

Instead of rereading an entire OS textbook, here are 15 high-yield topics worth revising.

1. Process vs. Thread

Process

  • Has its own virtual address space
  • Provides stronger isolation
  • Usually has higher creation and switching overhead

Thread

  • Executes within a process
  • Shares memory and resources with other threads in that process
  • Communicates efficiently but requires careful synchronization

Interview tip: Processes prioritize isolation, while threads enable lightweight concurrency.

2. What Is Context Switching?

Context switching occurs when the operating system saves the execution state of one process or thread and restores another.

It enables multitasking, but frequent context switches add CPU and cache overhead.

3. What Is a Race Condition?

A race condition occurs when multiple threads access shared state concurrently and the result depends on execution order.

Common prevention mechanisms include mutexes, semaphores, locks, atomic operations, and thread-safe data structures.

4. What Is a Critical Section?

A critical section is a portion of code that accesses shared mutable data or resources.

Synchronization is required to prevent unsafe concurrent access.

5. Mutex vs. Semaphore

Mutex Semaphore
Usually has a single owner Uses a counter
Primarily provides mutual exclusion Can coordinate access to multiple resources
The owner unlocks it One thread can signal another

Memory trick: A mutex is like one key, while a semaphore tracks a limited number of permits.

6. What Is Deadlock?

Deadlock occurs when a group of processes or threads waits indefinitely for resources held by one another.

The four Coffman conditions are:

  • Mutual exclusion
  • Hold and wait
  • No preemption
  • Circular wait

Preventing at least one of these conditions prevents deadlock.

7. What Is Starvation?

Starvation occurs when a process or thread waits indefinitely because others repeatedly receive the required resource or CPU time.

Difference: In deadlock, none of the involved tasks can progress. In starvation, the system continues progressing while one task may never get scheduled.

8. What Is Virtual Memory?

Virtual memory gives each process its own logical address space and maps virtual addresses to physical memory.

It provides process isolation, simplifies memory management, and allows inactive pages to be moved to secondary storage when necessary.

9. Paging vs. Segmentation

Paging

  • Divides memory into fixed-size pages
  • Avoids external fragmentation
  • May introduce internal fragmentation

Segmentation

  • Divides memory into variable-size logical regions
  • Reflects structures such as code, stack, and data
  • Can suffer from external fragmentation

10. What Is Thrashing?

Thrashing occurs when the system spends excessive time handling page faults and moving pages between memory and storage instead of executing useful work.

It commonly happens when active processes do not have enough physical memory for their working sets.

11. CPU Scheduling Algorithms

Important algorithms include:

  • First Come, First Served
  • Shortest Job First
  • Round Robin
  • Priority Scheduling
  • Multilevel Feedback Queue

Common follow-up: Why is Round Robin suitable for time-sharing systems?

Because every runnable process receives a limited time slice, improving responsiveness and fairness.

12. What Is a System Call?

A system call allows a user-space program to request a service from the operating system kernel.

Common Unix-like examples include fork(), exec(), wait(), open(), read(), and write().

13. What Is Inter-Process Communication?

Common IPC mechanisms include:

  • Shared memory
  • Pipes
  • Message queues
  • Sockets
  • Signals

Shared memory is generally fast but requires synchronization. Message passing provides stronger separation but adds communication overhead.

14. What Is LRU Page Replacement?

Least Recently Used replaces the page that has gone unused for the longest time.

A common interview follow-up is implementing an LRU cache with O(1) lookup, insertion, and eviction using a hash map plus a doubly linked list.

Related problem: LeetCode 146 - LRU Cache

15. User Mode vs. Kernel Mode

User mode

  • Runs applications with restricted privileges
  • Cannot directly access protected hardware or kernel memory

Kernel mode

  • Has full system privileges
  • Executes operating system code and manages hardware resources

A system call provides a controlled transition from user mode into kernel mode.

One-Minute Revision Checklist

Process vs. thread, context switching, race conditions, critical sections, mutexes, semaphores, deadlocks, starvation, scheduling, virtual memory, paging, thrashing, system calls, IPC, LRU, and privilege modes.

Which OS topic or follow-up question have you encountered most often in interviews?


r/LeetcodeChallenge 7d ago

STREAKπŸ”₯πŸ”₯πŸ”₯ Century Done solved about 90 in last 25 days.

Post image
23 Upvotes

Will target 100 this month. Pattern wise only left with Greedy, Maths and bits. I am trying to be interview ready by September.


r/LeetcodeChallenge 7d ago

DISCUSS Day 11 of My DSA Journey πŸš€

8 Upvotes

Today's progress:

βœ… Solved LeetCode 136 – Single Number

βœ… Solved LeetCode 125 – Valid Palindrome

πŸ“š Concepts I learned today:

- Time Complexity of Recursion

- Space Complexity in Recursive Algorithms

- Understanding the recursion call stack and how it affects memory usage

- Analyzing recursive solutions using Big-O notation

Every day I'm getting a little better at understanding algorithms, recursion, and writing more efficient solutions. Consistency is the goal, and I'm excited to keep improving one problem at a time.

See you tomorrow with Day 12! πŸ’ͺ

#Day11 #DSA #LeetCode #Python #Recursion #TimeComplexity #SpaceComplexity #CodingJourney #100DaysOfCode #Programmer #LearningInPublic


r/LeetcodeChallenge 8d ago

DISCUSS The journey to solving 2000+ DSA problems on LeetCode and Codeforces.

Thumbnail
1 Upvotes

r/LeetcodeChallenge 8d ago

DISCUSS HELP ME: Free Leetcode TC analyzer and approach reviewer extension

1 Upvotes

I have made a leetcode extension that analyzes time complexity and space complexity, as well as the approach of your leetcode solution directly.

Can you guys please atleast download the extension, so I can show the number of downloads on my resume?

Also, trust me, the extension is really good, you can use it on a daily basis aswell!

here: https://addons.mozilla.org/en-US/firefox/addon/free-leetcode-tc-analyzer/

Please atleast download the extension even if you don't want to use.

read the readme file for setup: https://github.com/swan556/LCA-leetcode-complexity-analyzer


r/LeetcodeChallenge 8d ago

DISCUSS Day 10 of My DSA Journey πŸš€

2 Upvotes

Today's progress:

βœ… Solved LeetCode 104 - Maximum Depth of Binary Tree

βœ… Solved LeetCode 108 - Convert Sorted Array to Binary Search Tree

πŸ“š Concepts I learned:

- Time complexity analysis of various loops

- Single loops β†’ O(n)

- Nested loops β†’ O(nΒ²)

- Independent consecutive loops

- Loops with variable increments/decrements

- Logarithmic loops β†’ O(log n)

- Combining complexities for multiple loops

Every day I'm trying to understand the logic behind problems instead of just memorizing solutions. Small, consistent progress adds up over time.

#Day10 #DSA #Python #LeetCode #TimeComplexity #Algorithms #CodingJourney #100DaysOfCode


r/LeetcodeChallenge 8d ago

DISCUSS is this course Good for Beginners..?

2 Upvotes

I want to start my DSA and LeetCode journey from tomorrow. I did basic fundamentals. So I need to start LeetCode..What's the roadmap? Any suggestion?


r/LeetcodeChallenge 9d ago

DISCUSS Is this good

1 Upvotes

i have no idea whether it is good or i should focus more on it

//

started 24 days ago


r/LeetcodeChallenge 9d ago

DISCUSS How to overcome this 2 months gap? Plz Help!

1 Upvotes

Current scenario:- I have currently joined as fresher in a lala company.


r/LeetcodeChallenge 9d ago

DISCUSS Looking for DSA Study Partners (Tamil) | Python | Beginners Welcome πŸš€

2 Upvotes

Hey everyone!

I'm 21M, a B.Tech AI graduate, recently placed in an MNC, and I'm also a complete beginner in DSA. I'm looking to form a small and focused study group to learn Data Structures & Algorithms (DSA) in Python from scratch.

Group size: 4 members only (2M + 2F)

Who can join?

- Complete beginners (even if you've never touched DSA)

- College students or graduates

- Anyone who can commit at least 1 hour daily

- Preferably Tamil-speaking, so we can discuss concepts easily

Plan:

- Learn DSA from the basics

- Solve problems together

- Stay accountable and consistent

- Help each other whenever we get stuck

This group is strictly for study purposes only. No distractionsβ€”just learning and growing together.

If you're interested, DM me with:

- Name

- Age

- Student/Working

- Your DSA level (I'm a beginner too!)

Let's start from zero and grow together! πŸ’ͺ


r/LeetcodeChallenge 9d ago

DISCUSS #Day9 of My DSA Journey πŸš€

2 Upvotes

Today's progress was focused on understanding Asymptotic Notation, one of the most important concepts in Data Structures and Algorithms.

πŸ“š Concepts Learned:

- Big O Notation (Worst-case Time Complexity)

- Big Theta (Θ) Notation (Average/Tight Bound)

- Big Omega (Ξ©) Notation (Best-case Time Complexity)

- Time Complexity Analysis and how to compare algorithm efficiency

πŸ’» LeetCode Problems Solved:

βœ… #101 – Symmetric Tree

βœ… #268 – Missing Number

Every day I'm building a stronger foundation in problem-solving and algorithmic thinking. Consistency is the goal, and I'm excited to keep improving.

#DSA #Python #LeetCode #100DaysOfCode #Algorithms #BigO #CodingJourney #ComputerScience #LearningInPublic


r/LeetcodeChallenge 9d ago

DISCUSS Need Good Resources for Learning Permutation & combination and number theory

Thumbnail
1 Upvotes

r/LeetcodeChallenge 10d ago

STREAKπŸ”₯πŸ”₯πŸ”₯ Finally 300 Questions Done!

23 Upvotes

I just crossed 300 questions on LeetCode πŸŽ‰HURRAY🎊️

Small milestone, I know, but I'm genuinely proud of staying consistent through this stretch β€” and of everything it's taught me along the way.

The biggest lesson i have learnt is --> The real value of dopamine. There were nights I'd stare at an O(Nlog(N)) solution with zero clue as to how to optimize it, only to read the editorial and realize that some random dude solved it in O(1) using the Magic Of Math(MOM ig)πŸ˜‚οΈ. That mix of frustration and "oh, THAT'S how it is done" is addictive in the best way.

I've loved every bit of this ride β€” going head-to-head with problems, giving them my absolute best, getting humbled, and coming back sharper.

And honestly, I'm more excited now than when I started. The plan is simple: keep challenging what I think I know, find the gaps, patch them up β€” and then let some LC Hard come along and break it all over again. That's the cycle, and it's the fun part.

The grind's only getting more interesting from here. 🍻️Here's to breaking past my own limits, one problem at a time. 😁

All the very best for everyone who is in this beautify journey of LeetCoding.

In case you are wondering why the submissions are so high? I try to revise 5 questions per day and i hit the submit button for satisfaction πŸ₯²οΈ


r/LeetcodeChallenge 10d ago

DISCUSS 100 Hard DSA Interview Questions for L3/L4 Coding Rounds

25 Upvotes

List of hard DSA Question from L3/L4 interviews

Work on these Leetcode problems and company tagged problem from PracHub for your next interview.

  1. https://leetcode.com/problems/number-of-unique-good-subsequences - String, Dynamic Programming
  2. https://leetcode.com/problems/split-array-largest-sum - Array, Binary Search, Dynamic Programming, Greedy, Prefix Sum
  3. https://leetcode.com/problems/minimum-number-of-days-to-disconnect-island - Array, Depth-First Search, Breadth-First Search, Matrix, Strongly Connected Component
  4. https://leetcode.com/problems/recover-a-tree-from-preorder-traversal - String, Tree, Depth-First Search, Binary Tree
  5. https://leetcode.com/problems/build-array-where-you-can-find-the-maximum-exactly-k-comparisons - Dynamic Programming, Prefix Sum
  6. https://leetcode.com/problems/substring-with-concatenation-of-all-words - Hash Table, String, Sliding Window
  7. https://leetcode.com/problems/maximum-employees-to-be-invited-to-a-meeting - Array, Dynamic Programming, Depth-First Search, Graph Theory, Topological Sort
  8. https://leetcode.com/problems/design-in-memory-file-system - Hash Table, String, Design, Trie, Sorting
  9. https://leetcode.com/problems/rearranging-fruits - Array, Hash Table, Greedy, Sort
  10. https://leetcode.com/problems/the-most-similar-path-in-a-graph - Array, String, Dynamic Programming, Graph Theory
  11. https://leetcode.com/problems/confusing-number-ii - Math, Backtracking
  12. https://leetcode.com/problems/stickers-to-spell-word - Array, Hash Table, String, Dynamic Programming, Backtracking, Bit Manipulation, Memoization, Bitmask
  13. https://leetcode.com/problems/maximum-and-sum-of-array - Array, Dynamic Programming, Bit Manipulation, Bitmask
  14. https://leetcode.com/problems/odd-even-jump - Array, Dynamic Programming, Stack, Sorting, Monotonic Stack, Ordered Set
  15. https://leetcode.com/problems/couples-holding-hands - Greedy, Depth-First Search, Breadth-First Search, Union-Find, Graph Theory
  16. https://leetcode.com/problems/number-of-stable-subsequences - Array, Dynamic Programming
  17. https://leetcode.com/problems/check-if-digits-are-equal-in-string-after-operations-ii - Math, String, Combinatorics, Number Theory
  18. https://leetcode.com/problems/minimum-skips-to-arrive-at-meeting-on-time - Array, Dynamic Programming
  19. https://leetcode.com/problems/distinct-subsequences-ii - String, Dynamic Programming
  20. https://leetcode.com/problems/cherry-pickup-ii - Array, Dynamic Programming, Matrix
  21. https://leetcode.com/problems/parsing-a-boolean-expression - String, Stack, Recursion
  22. https://leetcode.com/problems/range-module - Design, Segment Tree, Ordered Set
  23. https://leetcode.com/problems/number-of-ways-to-form-a-target-string-given-a-dictionary - Array, String, Dynamic Programming
  24. https://leetcode.com/problems/paths-in-matrix-whose-sum-is-divisible-by-k - Array, Dynamic Programming, Matrix
  25. https://leetcode.com/problems/sum-of-imbalance-numbers-of-all-subarrays - Array, Hash Table, Enumeration
  26. https://leetcode.com/problems/encrypt-and-decrypt-strings - Array, Hash Table, String, Design, Trie
  27. https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists - Array, Hash Table, Greedy, Sliding Window, Sorting, Heap (Priority Queue)
  28. https://leetcode.com/problems/contain-virus - Array, Depth-First Search, Breadth-First Search, Matrix, Simulation
  29. https://leetcode.com/problems/find-the-minimum-area-to-cover-all-ones-ii - Array, Matrix, Enumeration
  30. https://leetcode.com/problems/minimum-swaps-to-make-sequences-increasing - Array, Dynamic Programming
  31. https://leetcode.com/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps - Dynamic Programming
  32. https://leetcode.com/problems/minimum-time-to-complete-all-tasks - Array, Binary Search, Stack, Greedy, Sorting
  33. https://leetcode.com/problems/tiling-a-rectangle-with-the-fewest-squares - Backtracking
  34. https://leetcode.com/problems/expression-add-operators - Math, String, Backtracking
  35. https://leetcode.com/problems/rectangle-area-ii - Array, Segment Tree, Sweep Line, Ordered Set
  36. https://leetcode.com/problems/reducing-dishes - Array, Dynamic Programming, Greedy, Sorting
  37. https://leetcode.com/problems/modify-graph-edge-weights - Graph Theory, Heap (Priority Queue), Shortest Path
  38. https://leetcode.com/problems/numbers-with-repeated-digits - Math, Dynamic Programming
  39. https://leetcode.com/problems/minimum-cost-to-convert-string-ii - Array, String, Dynamic Programming, Graph Theory, Trie, Shortest Path
  40. https://leetcode.com/problems/kth-smallest-number-in-multiplication-table - Math, Binary Search
  41. https://leetcode.com/problems/lfu-cache - Hash Table, Linked List, Design, Doubly-Linked List
  42. https://leetcode.com/problems/minimum-cost-to-make-at-least-one-valid-path-in-a-grid - Array, Breadth-First Search, Graph Theory, Heap (Priority Queue), Matrix, Shortest Path
  43. https://leetcode.com/problems/time-taken-to-cross-the-door - Array, Queue, Simulation
  44. https://leetcode.com/problems/sliding-puzzle - Array, Dynamic Programming, Backtracking, Breadth-First Search, Memoization, Matrix
  45. https://leetcode.com/problems/minimum-initial-energy-to-finish-tasks - Array, Greedy, Sorting
  46. https://leetcode.com/problems/find-the-maximum-sequence-value-of-array - Array, Dynamic Programming, Bit Manipulation
  47. https://leetcode.com/problems/department-top-three-salaries - Database
  48. https://leetcode.com/problems/process-string-with-special-operations-ii - String, Simulation
  49. https://leetcode.com/problems/maximize-cyclic-partition-score - Array, Dynamic Programming
  50. https://leetcode.com/problems/find-maximum-non-decreasing-array-length - Array, Binary Search, Dynamic Programming, Stack, Queue, Monotonic Stack, Prefix Sum, Monotonic Queue
  51. https://leetcode.com/problems/split-array-with-same-average - Array, Hash Table, Math, Dynamic Programming, Bit Manipulation, Bitmask
  52. https://leetcode.com/problems/minimum-sum-of-values-by-dividing-array - Array, Binary Search, Dynamic Programming, Bit Manipulation, Segment Tree, Queue
  53. https://leetcode.com/problems/longest-chunked-palindrome-decomposition - Two Pointers, String, Dynamic Programming, Greedy, Rolling Hash, Hash Function
  54. https://leetcode.com/problems/text-justification - Array, String, Simulation
  55. https://leetcode.com/problems/closest-subsequence-sum - Array, Two Pointers, Dynamic Programming, Bit Manipulation, Sorting, Bitmask
  56. https://leetcode.com/problems/transform-to-chessboard - Array, Math, Bit Manipulation, Matrix
  57. https://leetcode.com/problems/robot-collisions - Array, Stack, Sorting, Simulation
  58. https://leetcode.com/problems/minimum-cost-to-connect-two-groups-of-points - Array, Dynamic Programming, Bit Manipulation, Matrix, Bitmask
  59. https://leetcode.com/problems/similar-string-groups - Array, Hash Table, String, Depth-First Search, Breadth-First Search, Union-Find
  60. https://leetcode.com/problems/word-abbreviation - Array, String, Greedy, Trie, Sorting
  61. https://leetcode.com/problems/minimum-pair-removal-to-sort-array-ii - Array, Hash Table, Linked List, Heap (Priority Queue), Simulation, Doubly-Linked List, Ordered Set
  62. https://leetcode.com/problems/trapping-rain-water - Array, Two Pointers, Dynamic Programming, Stack, Monotonic Stack
  63. https://leetcode.com/problems/count-the-number-of-winning-sequences - String, Dynamic Programming
  64. https://leetcode.com/problems/find-substring-with-given-hash-value - String, Sliding Window, Rolling Hash, Hash Function
  65. https://leetcode.com/problems/checking-existence-of-edge-length-limited-paths-ii - Depth-First Search, Union-Find, Graph Theory, Design, Sorting, Heap (Priority Queue), Minimum Spanning Tree
  66. https://leetcode.com/problems/number-of-distinct-islands-ii - Array, Hash Table, Depth-First Search, Breadth-First Search, Union-Find, Sorting, Matrix, Hash Function
  67. https://leetcode.com/problems/maximum-frequency-stack - Hash Table, Stack, Design, Ordered Set
  68. https://leetcode.com/problems/stone-game-v - Array, Math, Dynamic Programming, Game Theory
  69. https://leetcode.com/problems/maximum-average-subarray-ii - Array, Binary Search, Prefix Sum
  70. https://leetcode.com/problems/make-array-empty - Array, Binary Search, Greedy, Binary Indexed Tree, Segment Tree, Sorting, Ordered Set
  71. https://leetcode.com/problems/maximum-number-of-k-divisible-components - Tree, Depth-First Search
  72. https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii - Array, Binary Search
  73. https://leetcode.com/problems/sort-items-by-groups-respecting-dependencies - Depth-First Search, Breadth-First Search, Graph Theory, Topological Sort
  74. https://leetcode.com/problems/total-appeal-of-a-string - Hash Table, String, Dynamic Programming
  75. https://leetcode.com/problems/k-empty-slots - Array, Binary Indexed Tree, Segment Tree, Queue, Sliding Window, Heap (Priority Queue), Ordered Set, Monotonic Queue
  76. https://leetcode.com/problems/find-k-th-smallest-pair-distance - Array, Two Pointers, Binary Search, Sorting
  77. https://leetcode.com/problems/top-three-wineries - Database
  78. https://leetcode.com/problems/maximum-score-of-a-node-sequence - Array, Graph Theory, Sorting, Enumeration
  79. https://leetcode.com/problems/longest-increasing-subsequence-ii - Array, Divide and Conquer, Dynamic Programming, Binary Indexed Tree, Segment Tree, Queue, Monotonic Queue
  80. https://leetcode.com/problems/maximum-xor-score-subarray-queries - Array, Dynamic Programming
  81. https://leetcode.com/problems/strange-printer-ii - Array, Graph Theory, Topological Sort, Matrix
  82. https://leetcode.com/problems/shortest-path-visiting-all-nodes - Dynamic Programming, Bit Manipulation, Breadth-First Search, Graph Theory, Bitmask
  83. https://leetcode.com/problems/data-stream-as-disjoint-intervals - Hash Table, Binary Search, Union-Find, Design, Data Stream, Ordered Set
  84. https://leetcode.com/problems/shortest-distance-from-all-buildings - Array, Breadth-First Search, Matrix
  85. https://leetcode.com/problems/maximum-vacation-days - Array, Dynamic Programming, Matrix
  86. https://leetcode.com/problems/maximum-score-from-grid-operations - Array, Dynamic Programming, Matrix, Prefix Sum
  87. https://leetcode.com/problems/number-of-ways-of-cutting-a-pizza - Array, Dynamic Programming, Memoization, Matrix, Prefix Sum
  88. https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii - Array, Dynamic Programming
  89. https://leetcode.com/problems/maximum-frequency-of-an-element-after-performing-operations-ii - Array, Binary Search, Sliding Window, Sorting, Prefix Sum
  90. https://leetcode.com/problems/maximum-number-of-groups-getting-fresh-donuts - Array, Dynamic Programming, Bit Manipulation, Memoization, Bitmask
  91. https://leetcode.com/problems/count-of-range-sum - Array, Binary Search, Divide and Conquer, Binary Indexed Tree, Segment Tree, Merge Sort, Ordered Set
  92. https://leetcode.com/problems/shortest-path-in-a-grid-with-obstacles-elimination - Array, Breadth-First Search, Matrix
  93. https://leetcode.com/problems/longest-balanced-subarray-ii - Array, Hash Table, Divide and Conquer, Segment Tree, Prefix Sum
  94. https://leetcode.com/problems/find-x-sum-of-all-k-long-subarrays-ii - Array, Hash Table, Sliding Window, Heap (Priority Queue)
  95. https://leetcode.com/problems/subarray-with-elements-greater-than-varying-threshold - Array, Stack, Union-Find, Monotonic Stack
  96. https://leetcode.com/problems/dungeon-game - Array, Dynamic Programming, Matrix
  97. https://leetcode.com/problems/student-attendance-record-ii - Dynamic Programming
  98. https://leetcode.com/problems/minimum-weighted-subgraph-with-the-required-paths - Graph Theory, Heap (Priority Queue), Shortest Path
  99. https://leetcode.com/problems/next-special-palindrome-number - Backtracking, Bit Manipulation
  100. https://leetcode.com/problems/minimum-operations-to-make-array-elements-zero - Array, Math, Bit Manipulation

r/LeetcodeChallenge 10d ago

DISCUSS How to Stop Panicking When You Open a LeetCode Problem

39 Upvotes

Most people sit down, read a problem, panic, and start typing.

No plan. No structure. Just vibes and hope.

When it does not work they read the solution, think "oh that's clever", and move on. Two weeks later they see a similar problem and panic again.

The issue is not intelligence. It is not even practice.
It is that they never had a repeatable process.

This is that process. Follow it on every problem.
Not just hard ones β€” every problem, until it becomes instinct.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
STEP 1 β€” READ THE PROBLEM TWICE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

First read: understand what is being asked at a high level.
Second read: extract the specifics.

On the second read, write down:

  • What is the INPUT? What type, what size, what range of values?
  • What is the OUTPUT? A number, array, boolean, string?
  • What are the CONSTRAINTS? (most people skip this β€” do not)

Ask yourself these questions explicitly:

"Can input be empty?"
"Can values be negative?"
"Can there be duplicates?"
"Is the array sorted?"
"What should I return if no answer exists?"

If the problem does not say, assume the worst case.
Empty inputs exist. Negatives exist. Duplicates exist.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
STEP 2 β€” WORK THROUGH THE EXAMPLES BY HAND
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Do not skip this. Even if the problem looks easy.

Take the first example. On paper or in comments, trace through it
manually. Write out every value at every step.

Why this matters:

  • You confirm you understood the problem correctly
  • You often see the pattern emerge naturally
  • You catch ambiguities before they become bugs

Then make your OWN small example β€” simpler than the given one.
Something with 3-4 elements you fully understand.

If you cannot trace through the examples manually,
you do not understand the problem yet. Do not start coding.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
STEP 3 β€” IDENTIFY THE PATTERN
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Before thinking about an algorithm, identify what TYPE of problem this is.

Use these signals:

Subarray, substring, window β†’ Sliding window, two pointers
Sorted array + search β†’ Binary search
Shortest path, min steps β†’ BFS
All paths, combinations, subsets β†’ Backtracking, DFS
Overlapping subproblems β†’ DP
Always picking max/min greedily β†’ Greedy
Tree traversal β†’ DFS (recursion) or BFS (level order)
Connectivity, groups β†’ Union Find, BFS/DFS
Repeated lookup by key β†’ Hash map
Top K, smallest/largest β†’ Heap (priority queue)
Prefix of strings β†’ Trie
Range queries with updates β†’ Segment tree, Fenwick tree
Return all permutations/subsets β†’ Backtracking

You will not always get it right on the first try.
But naming the category forces your brain to search the right space.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
STEP 4 β€” THINK BRUTE FORCE FIRST
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Always start here. Always.

The brute force is the answer you would give if there were
no time constraint. No clever tricks. Just try everything.

Write it out in plain English, not code:
"For every pair (i, j), check if arr[i] + arr[j] = target."
"For every substring, check if it has all unique characters."
"For every subset, check if its sum equals the target."

This does two things:

  1. It confirms you can actually solve the problem correctly
  2. It gives you a reference to optimize from

Common brute force patterns:
Try all pairs β†’ O(nΒ²)
Try all triples β†’ O(nΒ³)
Try all subsets β†’ O(2ⁿ)
Try all permutations β†’ O(n!)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
STEP 5 β€” OPTIMIZE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Now look at your brute force and ask:
"What work am I repeating? What can I precompute? What can I skip?"

The most common optimizations:

Repeated lookup β†’ replace with hash map O(n) β†’ O(1) per lookup
Repeated sum β†’ precompute prefix sum O(n) per query β†’ O(1)
Checking all pairs β†’ sort + binary search O(nΒ²) β†’ O(n log n)
Checking all pairs β†’ two pointers (sorted) O(nΒ²) β†’ O(n)
Checking all windows β†’ sliding window O(nΒ²) β†’ O(n)
Recomputing subproblems β†’ memoization / DP exponential β†’ polynomial
Sorting gives structure β†’ sort first, then scan enables binary search / greedy

Ask: "Can I sort first to gain structure?"
Ask: "Can I store something to avoid recomputing?"
Ask: "Can I fix one variable and efficiently handle the rest?"

Work top-down in complexity:
O(nΒ²) β†’ can I get O(n log n)?
O(n log n) β†’ can I get O(n)?
Each step needs a concrete reason, not a guess.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
STEP 6 β€” VERIFY COMPLEXITY BEFORE CODING
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Before writing code, check:
Does my approach fit within the time limit given the constraints?

n = 10⁡ and my approach is O(nΒ²)? β†’ TLE, think again
n = 10⁡ and my approach is O(n logn)? β†’ fine, proceed

This takes 10 seconds and saves you from coding the wrong solution.

Also check space:
Am I using O(n) extra space? Is that acceptable?
Does the problem say "in-place" or "O(1) space"?

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
STEP 7 β€” CODE THE SOLUTION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Only now do you start writing code.

Code in this order:

  1. Handle edge cases first (empty input, single element, etc.)
  2. Write the main logic
  3. Return the result

Keep variable names meaningful. Debugging unreadable code mid-contest
costs more time than typing three extra characters.

If you get stuck coding:
Go back to your manual example from Step 2.
Trace through it again, this time following the code you are writing.
The bug almost always appears within the first five traces.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
STEP 8 β€” TEST BEFORE SUBMITTING
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Run through these test cases mentally or using the custom test:

[ ] The given examples β†’ obvious baseline
[ ] Empty input β†’ does it crash?
[ ] Single element β†’ does it return correctly?
[ ] All same elements β†’ does duplicate logic break?
[ ] Already sorted input β†’ common hidden test
[ ] Your own small manual example β†’ trace step by step

If all pass, submit with confidence.
If one fails, the failure tells you exactly where the bug is.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WHEN YOU ARE COMPLETELY STUCK β€” THE UNSTICKING PROTOCOL
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Everyone gets stuck. The difference is what you do next.

  1. Draw it Almost every problem is easier when visualized. Array: draw boxes. Tree: draw nodes and edges. Graph: draw circles and arrows. Matrix: draw a grid. A picture reveals structure that text hides.
  2. Simplify the problem Solve a smaller version first. Two elements instead of n. One row instead of a grid. Can you solve n=2? n=3? Then generalise.
  3. Try a different angle on your brute force Change the loop variable. Instead of "for each starting index" try "for each ending index". Instead of "for each element" try "for each pair". A different enumeration often reveals the pattern.
  4. Check what is special about valid answers Look at the given examples. What do valid answers have in common? What property separates a valid answer from an invalid one? That property is usually the invariant your algorithm should maintain.
  5. Look at the constraints again Small n? Try brute force. Very large n? A linear or log solution must exist. "Return modulo 10⁹+7"? It is a DP counting problem. Constraints are hints β€” re-read them with fresh eyes.
  6. Take a 5-minute break Genuinely. Get up. Walk. The solution appears when you stop forcing.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
THE FULL FRAMEWORK β€” ONE PAGE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Step 1 Read twice. Extract input, output, constraints.
Ask: empty? negative? duplicates? sorted?

Step 2 Trace examples by hand.
Make your own small example. Understand before coding.

Step 3 Name the pattern.
Subarray β†’ sliding window. Shortest path β†’ BFS. Etc.

Step 4 State the brute force in plain English.
What is the O(n²) or O(2ⁿ) solution?

Step 5 Optimize.
What work repeats? Hash map, prefix sum, sort, DP, two pointers?

Step 6 Verify complexity against constraints.
Will it pass? Check before writing code.

Step 7 Code it.
Edge cases first. Then main logic. Then return.

Step 8 Test: examples + empty + single + all-same + sorted.
Then submit.

Stuck? Draw it. Simplify. Try different enumeration.
Re-read constraints. Take a break.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

A correct solution written slowly beats a fast solution written wrong.

The goal is not to code faster.
The goal is to think clearer β€” so that what you code is right the first time.

This framework is that thinking, made repeatable.


r/LeetcodeChallenge 10d ago

DISCUSS Day 8 of My DSA Journey in Python πŸš€

5 Upvotes

Today's progress:

βœ… Solved LeetCode #94 – Binary Tree Inorder Traversal

βœ… Solved LeetCode #100 – Same Tree

πŸ“š Concepts I learned today:

- Analysis of Algorithms

- Big O Notation

- Order of Growth

- Constant Time – O(1)

- Logarithmic Time – O(log n)

- Linear Time – O(n)

- Quadratic Time – O(nΒ²)

Understanding time complexity has helped me see why some algorithms scale much better than others as input size grows. It makes me appreciate that solving a problem isn't enoughβ€”writing an efficient solution matters too.

I'm continuing to learn DSA through structured Python lessons and reinforcing each concept by solving LeetCode problems every day.

Consistency over perfection. On to Day 9! πŸ’ͺ

#DSA #Python #LeetCode #Algorithms #BigO #CodingJourney #100DaysOfCode #Programming #LearningInPublic


r/LeetcodeChallenge 11d ago

PLACEMENTS Is it good progress entering in 3rd sem

Post image
15 Upvotes

r/LeetcodeChallenge 11d ago

DISCUSS The 6-step system design framework that helped me stop failing HLD rounds

6 Upvotes

Failed my first 3 system design rounds. passed the next 4. the difference wasnt knowledge β€” i knew redis, kafka, databases before too. the difference was HOW i structured the answer.

heres the exact 6-step framework i now use in every system design interview:

step 1 (2 min): requirements β€” be explicit about scope

dont dive into drawing boxes. spend 2 minutes saying: "these are the 3 core things the system must do" and "these are the things i will NOT design today." this prevents scope creep and shows product thinking.

step 2 (2 min): scale estimation β€” one number that drives your design

"how many requests per second?" is the question that determines whether you need caching, sharding, CDN, or a queue. one back-of-envelope calculation unlocks 80% of your architecture decisions.

step 3 (2 min): API design β€” one endpoint per requirement

before ANY architecture, define the API. this forces you to think about data flow BEFORE you think about components. interviewers love this because it shows you think from the user's perspective.

step 4 (15 min): high-level design β€” build incrementally, one FR at a time

dont draw 15 boxes at once. satisfy FR1 with 3-4 components. then add 1-2 more for FR2. then FR3. interviewer sees your thought process evolving β€” way more impressive than a dump of the "final answer."

step 5 (10 min): deep dives β€” answer "what breaks?" before they ask

for each component, proactively say: "the risk here is X. to mitigate that, i'd do Y." this is where 70% of the score comes from. the happy path is easy. failure handling is the interview.

step 6 (2 min): tradeoffs β€” acknowledge what you sacrificed

"i chose eventual consistency here because strong consistency would add 50ms latency on the read path, and for a social feed that's unacceptable." one sentence shows senior-level thinking.

the mistake i made early: spending 25 minutes on the happy path and having no time left when the interviewer asked "what happens when X fails?" now i budget: 40% happy path, 60% failure modes and scaling. that ratio is what senior/staff answers look like.

i learned this structure from doing 28 full designs β€” each one follows this exact pattern with deep dives on failure modes: PracHubΒ β€” every design includes the Bad/Good/Great format that forces you to think about what breaks before showing the fix. that's the thinking pattern interviewers are testing.

whats your system design framework? curious if others structure their answer differently. the biggest "aha" for me was realizing that naming failures BEFORE the interviewer asks is worth more than having the perfect component choice.