TGViewer
Channel Public Channel
Coding Interview Preparation

Coding Interview Preparation

@coding_interview_preparation

Coding interview preparation for software engineers

Interview questions, DSA, clean solutions.
Join πŸ‘‰ https://rebrand.ly/bigdatachannels

Buy ads: https://telega.io/c/coding_interview_preparation

DMCA: @disclosure_bds
Contact: @mldatascientist
Subscribers
5.9K
Photos
486
Videos
2
Links
174

Showing posts older than #1276 Β· Back to latest

Older Posts 20 shown
Post #1274 648
❔Interviewer:
What is a race condition and how do you prevent it?


βœ… Answer:

A race condition occurs when multiple threads access and modify shared data concurrently, and the final result depends on the timing of their execution. This can lead to inconsistent or unpredictable behavior.

To prevent race conditions, I typically use synchronization mechanisms such as mutexes, locks, or semaphores to ensure only one thread modifies critical sections at a time. In some cases, I prefer immutable data structures or atomic operations to reduce locking overhead. The choice depends on the performance requirements and contention level.
  • ❀ 2
Post #1271 769
❔Interviewer:
How do you learn a new technology quickly?


βœ… Answer:

My approach is to first understand the core mental model by reading the official documentation rather than jumping straight into tutorials.

Then I build a small end to end project to get hands on familiarity. After that, I study real world production use cases to understand best practices and common pitfalls.

Finally, I try to apply the technology in a meaningful project because I find retention is much higher when learning is tied to real problems.
  • πŸ‘ 2
Post #1268 802
❔Interviewer:
How would you handle a sudden spike in traffic?


βœ… Answer:

I would approach this in layers. In the short term, I would protect the system using rate limiting and load shedding to prevent total failure.

Next, I would ensure horizontal scaling behind a load balancer so additional instances can absorb the traffic. I would also introduce caching for frequently requested data and consider using a message queue to smooth traffic spikes.

Long term, I would analyze traffic patterns and redesign any bottlenecks to make the system more resilient to bursty workloads.
  • πŸ₯° 3
Post #1265 763
RESTful API Design Checklist
  • ❀ 4
Post #1263 821
❔Interviwer:
What happens when you type a URL into the browser?


βœ… Answer:

When a URL is entered, the browser first checks its cache and then performs DNS resolution to translate the domain name into an IP address.

Next, the browser establishes a TCP connection with the server, followed by a TLS handshake if the connection is HTTPS. The browser then sends an HTTP request to the server.

The server processes the request and returns an HTTP response. Finally, the browser parses the HTML, constructs the DOM and CSSOM, executes JavaScript if present, and renders the page to the screen.
  • πŸ™ 6
Post #1261 797
❔Interviewer:
Explain how a hash map works internally.


βœ… Answer:

A hash map stores key value pairs by applying a hash function to the key to compute an index in an underlying array. Ideally, the hash function distributes keys uniformly to minimize collisions.

When collisions occur, common strategies include chaining using linked lists or open addressing. Lookups, insertions, and deletions are O(1) on average but can degrade toward O(n) in worst case collision scenarios.

In modern implementations like Java’s HashMap, when collision chains grow beyond a threshold, they may be converted into balanced trees to maintain efficient performance.
  • ❀ 4
Post #1259 834
πŸ’» Coding Interview Questions

1️⃣ What is a binary search tree (BST)?
Answer: A tree where left child < parent < right child.

2️⃣ What is tree traversal?
Answer: Visiting all nodes in a tree (inorder, preorder, postorder).

3️⃣ What is a graph?
Answer: A set of nodes (vertices) connected by edges.

4️⃣ Directed vs Undirected graph?
Answer: Directed has edges with direction; undirected has edges without direction.

5️⃣ What is a cycle in a graph?
Answer: A path that starts and ends at the same vertex.

6️⃣ What is BFS (Breadth-First Search)?
Answer: Traverses graph level by level using a queue.

7️⃣ What is DFS (Depth-First Search)?
Answer: Traverses graph by exploring as far as possible along each branch (stack/recursion).

8️⃣ What is a weighted graph?
Answer: A graph where edges have weights (costs).

9️⃣ What is Dijkstra’s algorithm?
Answer: Finds the shortest path from a source to all nodes in a weighted graph.

πŸ”Ÿ What is a topological sort?
Answer: Linear ordering of vertices such that for every directed edge u→v, u comes before v.
  • πŸ”₯ 3
  • ❀ 2
  • πŸ‘ 1
Post #1258 705
The Almost Finished but Not Quite Ending

πŸ—―Scenario: Time is nearly up and your solution is mostly there but not fully polished.

πŸ‘‰ Do this: Do not panic code. Clearly state what remains, what works, and what you would finish next with more time. Quickly mention time and space complexity. Interviewers often give partial credit for structured thinking and honesty. A clean wrap up is far better than rushed, silent typing.
  • ❀ 4
Post #1257 783
Explain a project you are proud of.


🫨Why it is hard:
Most candidates ramble or focus only on features.

Use the STAR plus METRICS framework:

Situation
Task
Action
Result +
Metrics

βœ… Strong example:
I built a booking system that reduced manual processing. I designed the API with Express and optimized database queries with indexing. As a result, average response time dropped from 900 ms to 180 ms and the system handled 3x more concurrent users.


πŸ”‘ Key thing to remember: numbers make your story believable.
  • πŸ‘ 4
Post #1255 776
πŸ’» Coding Interview Questions

1️⃣ What is a heap?
Answer: A complete binary tree where parent nodes are greater (max-heap) or smaller (min-heap) than children.

2️⃣ Heap vs Priority Queue?
Answer: A heap is a data structure; a priority queue uses a heap to manage priorities.

3️⃣ What is a trie?
Answer: A tree used to store strings for efficient prefix searches.

4️⃣ What is dynamic array?
Answer: An array that resizes automatically when full (e.g., Python list, Java ArrayList).

5️⃣ What is a hash set?
Answer: Stores unique elements with fast lookup, using a hash table internally.

6️⃣ What is a circular queue?
Answer: A queue where the end connects back to the start to reuse empty space.

7️⃣ What is a sentinel node?
Answer: A dummy node used to simplify boundary conditions in linked lists or trees.

8️⃣ What is a graph adjacency list?
Answer: A list storing all neighbors of each vertex for efficient storage.

9️⃣ What is a graph adjacency matrix?
Answer: A 2D array representing edges; cell[i][j]=1 if edge exists.

πŸ”Ÿ What is complexity of inserting into a hash table?
Answer: Average O(1), worst-case O(n) if many collisions occur.
  • ❀ 3
Post #1254 644
Tell me about a time you disagreed with a teammate.


🫨Why it is hard:
Many developers either sound confrontational or overly passive.

Use the S B I R framework:

Situation
Behavior (what happened)
Impact
Resolution

βœ… Example answer:
In a previous project, we disagreed on introducing a new caching layer. I raised concerns about cache invalidation complexity and proposed we measure current latency first. We ran benchmarks together and agreed on a simpler optimization that met our needs.


What interviewers look for: collaboration + data driven thinking.
Older posts β†’
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook β†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 β†’