Coding interview preparation
5.82K subscribers
477 photos
1 video
97 files
168 links
Coding interview preparation for software engineers

Daily interview questions, algorithms, data structures & clean solutions.

Real interview tasks and problems.
Join πŸ‘‰ https://rebrand.ly/bigdatachannels

DMCA: @disclosure_bds
Contact: @mldatascientist
Download Telegram
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
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
πŸ’» 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
❔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
❔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
RESTful API Design Checklist
❀4
❔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
❔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
Forwarded from Programming Quiz Channel
Which structure is best for undo operations?
Anonymous Quiz
25%
Queue
46%
Stack
22%
Heap
7%
Graph
❔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
Forwarded from Programming Quiz Channel
Which algorithm technique solves overlapping subproblems?
Anonymous Quiz
9%
Greedy
30%
Divide and conquer
47%
Dynamic programming
15%
Backtracking
❀3
Cloudflare vs AWS vs Azure
❀2πŸ‘2
Batch of Web Development Interview Questions

❔ How would you optimize a website that is loading too slowly?

βœ… Answer:

I would start by analyzing the 'Critical Rendering Path' using tools like Lighthouse or Chrome DevTools to identify the biggest bottlenecks, whether it's large images, render-blocking JavaScript, or slow server response times.

Next, I would implement immediate 'Quick Wins' on the frontend. This includes compressing and converting images to modern formats like WebP, minifying CSS/JS files, and using "Lazy Loading" so that off-screen images only load when the user scrolls to them. I would also move non-essential scripts to the end of the HTML or use async/defer attributes.

Long term, I would look at architectural improvements. This might involve implementing a Content Delivery Network (CDN) to serve assets closer to the user, setting up efficient browser caching strategies, and potentially moving from a standard Client-Side Rendering (CSR) model to Server-Side Rendering (SSR) or Static Site Generation (SSG) to ensure the first paint happens as fast as possible.



❔What is CORS, and how do you resolve 'CORS Errors' in production?

βœ… Answer:

I would explain that CORS (Cross-Origin Resource Sharing) is a browser security feature that prevents a web page from making requests to a different domain than the one that served it. It’s the browser's way of protecting users from malicious scripts.

In the short term, to fix a CORS error, I would configure the backend headers. I’d ensure the server sends the Access-Control-Allow-Origin header specifying the exact domain of the frontend. During development, a proxy can be used, but for production, the server must explicitly whitelist the allowed origins.

Long term, I would ensure the security strategy is robust. Instead of using wildcards (*), which are dangerous, I would implement a dynamic whitelist. I would also ensure that sensitive "pre-flight" requests (OPTIONS) are handled correctly by the server and that any authentication cookies are managed using the SameSite and Secure attributes to maintain a high security posture while allowing cross-origin functionality.



❔When should you choose Server-Side Rendering (SSR) over Static Site Generation (SSG)?

βœ… Answer:

I would base the decision on how often the data changes. I’d use SSG (Static Site Generation) for pages where the content is the same for every user and doesn't change frequently like a blog, a documentation site, or a marketing page. SSG is the fastest option because the HTML is built once at build time.

I would choose SSR (Server-Side Rendering) for pages that need to show real-time, user-specific data, such as a personalized dashboard or a search results page. Since the server generates a fresh HTML page for every request, the user always sees the most up-to-date information, which is also great for SEO on dynamic pages.

Long term, I would look into Hybrid approaches like Incremental Static Regeneration (ISR). This allows us to keep the speed of SSG but update specific static pages in the background as data changes, giving us the best of both worlds, performance and freshness, without taxing the server on every single hit.
πŸ”₯3❀1
Forwarded from Programming Quiz Channel
Which programming paradigm focuses on functions without side effects?
Anonymous Quiz
40%
OOP
35%
Functional
16%
Procedural
10%
Imperative
❀5