Coding Interview Preparation
5.91K subscribers
483 photos
2 videos
113 files
173 links
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
Download Telegram
⚠️ COMMON INTERVIEW MISTAKE #4 - Bad-Mouthing a Previous Employer

This comes up constantly in "why are you leaving your current role" - and it's one of the fastest ways to quietly lose an interviewer's trust, even if every word you say is true.

Here's why: the interviewer isn't just evaluating your former company. They're predicting how you'll talk about THEIR company someday, if things go wrong.

❌ "My manager was incompetent and the whole team was toxic, honestly I couldn't wait to leave."

✅ "I've grown a lot in my current role, but I'm looking for a team with more opportunities to work on [specific thing] - that's actually what drew me to this opening."

Notice the good version is still honest - you ARE leaving because something's missing - it's just framed around what you're moving toward, not what you're running from.

If something was genuinely toxic or unethical, it's fine to be honest at a high level ("there were some communication issues on my team") - just don't turn it into a 5-minute complaint session. One sentence, then pivot forward.

Have you ever had to bite your tongue about a former job in an interview? 😅
Quantum Technologies for Cybersecurity.pdf
2.8 MB
👋Hello Everyone

One of our Member asked for Quantum Cryptography Resources a while ago... … and here they are!

These free university notes and slides break down quantum cryptography in a clear, practical way: covering the classic BB84 protocol, how eavesdropping gets detected, key reconciliation, privacy amplification, and the main variants like B92 and E91.

These are great quick-reference materials if you want to understand how quantum key distribution actually works without going through dense textbooks.
❤2
🎯 CODING CHALLENGE #8 - Course Schedule (Detect Cycle in a Graph)
Difficulty: Medium-Hard | Asked at: Google, Meta, Uber

You have numCourses courses, and a list of prerequisite pairs [a, b] meaning "to take course a, you must first take course b." Determine if it's possible to finish all courses (i.e., there's no cyclic dependency).


Input: numCourses = 2, prerequisites = [[1,0]]
Output: true

Input: numCourses = 2, prerequisites = [[1,0],[0,1]]
Output: false (cycle: 0 needs 1, 1 needs 0)


💡 Hint: This is cycle detection in a directed graph. Topological sort (Kahn's algorithm using in-degrees) is the cleanest approach.

Solution:
python
from collections import deque

def can_finish(num_courses, prerequisites):
graph = {i: [] for i in range(num_courses)}
in_degree = [0] * num_courses

for course, prereq in prerequisites:
graph[prereq].append(course)
in_degree[course] += 1

queue = deque([i for i in range(num_courses) if in_degree[i] == 0])
completed = 0

while queue:
node = queue.popleft()
completed += 1
for neighbor in graph[node]:
in_degree[neighbor] -= 1
if in_degree[neighbor] == 0:
queue.append(neighbor)

return completed == num_courses


Complexity: O(V + E) time and space, where V is courses and E is prerequisite pairs.

Common mistake: Trying to solve this with plain DFS + a visited set, without tracking the CURRENT recursion path separately. You need to distinguish "visited overall" from "visited in this current path" - otherwise you can't actually detect a cycle, only whether a node's been seen at all.

This "can this graph be finished/ordered" pattern (topological sort) shows up under many disguises - build systems, task scheduling, spreadsheet formula dependencies. Recognize the shape and you'll spot it fast.

Kahn's algorithm or DFS-based cycle detection - which do you find more intuitive? 👇
🗣️ BEHAVIORAL INTERVIEW #4 - "Why Do You Want to Work Here?"

The laziest possible answer: "I've heard great things about the culture and I'm excited about the growth opportunities." Every interviewer has heard this exact sentence a thousand times, and it signals you didn't actually research the company.

✅ What separates a great answer:

1️⃣ Reference something SPECIFIC about the company - a product decision, an engineering blog post, a technical challenge unique to their scale.
2️⃣ Connect it to YOUR specific experience or interests - not generically "I'm passionate about tech."
3️⃣ Show you've thought about what you'd actually be doing day-to-day, not just the brand name.

Example:
"I read your engineering blog post about migrating from a monolith to microservices, and the challenges you described around data consistency really matched what I worked through in my current role, just at a much smaller scale. I'm excited about tackling that same problem at 10x the complexity, and learning from a team that's already been through it."

This takes 15 minutes of research beforehand and instantly puts you ahead of 80% of candidates who show up unprepared for this exact question.

Do you research the company's engineering blog before interviews? If not, put it on your prep checklist right now 😉
🔥1
🕵️ RECRUITER SECRETS #5 - The Truth About "Overqualified"

Ever been told you're "overqualified" for a role? Here's what's actually going on behind that phrase, because it's rarely about your skills:

🔹 Flight risk concern: they're worried you'll leave the moment something better comes along, wasting their onboarding investment.

🔹 Salary concern: they assume you'll ask for more than the role is budgeted for.

🔹 Team dynamics concern: they worry you'll be frustrated reporting to someone more junior, or bored by the scope of work.

✅ How to address it directly, if you actually want the role:

"I understand the concern - I'm specifically looking for [genuine reason: better work-life balance / a switch to a domain I'm passionate about / a smaller team where I have more ownership], and I'm fully aligned with the scope and comp for this level. I'm not looking at this as a stepping stone."

Naming the concern directly and addressing it head-on is far more effective than hoping it doesn't come up. Vague reassurance ("no really, I just want this job!") without addressing WHY they're worried usually doesn't land.

If it's genuinely not the right fit level for you, that's okay too - but going in with a real, honest answer to "why would you take a step back" beats dodging the question every time.

Has "overqualified" ever come up for you? How'd you handle it? 👇
🐛 SPOT THE BUG #5
Language: SQL

sql
SELECT customer_id, COUNT(*) as order_count
FROM orders
WHERE order_date > '2024-01-01'
GROUP BY customer_id
ORDER BY order_count DESC
LIMIT 1;


Goal: find the customer with the most orders after Jan 1st, 2024.

Looks right at first glance - what's the subtle issue? 👇

.
.
.

The bug: LIMIT 1 silently drops any ties. If TWO customers are tied for the most orders, this query arbitrarily returns just one of them (and which one is returned isn't guaranteed to be consistent across database engines or even across runs).

If the actual requirement is "find ALL customers tied for the most orders," this query quietly gives a wrong (incomplete) answer that LOOKS correct.

Fixed version (handles ties):
sql
WITH ranked AS (
SELECT customer_id, COUNT(*) as order_count,
RANK() OVER (ORDER BY COUNT(*) DESC) as rnk
FROM orders
WHERE order_date > '2024-01-01'
GROUP BY customer_id
)
SELECT customer_id, order_count
FROM ranked
WHERE rnk = 1;


💡 This is a great example of why clarifying requirements matters even in SQL questions - "top 1" and "all customers tied for the top spot" are genuinely different problems, and a query that's correct for one is silently wrong for the other.

Have you ever shipped a query that "worked" but quietly handled ties incorrectly? 👇
📊 SQL SATURDAY #6 - Self Joins and Hierarchies


employees
+----+---------+-----------+
| id | name | manager_id|
+----+---------+-----------+
| 1 | Alice | NULL |
| 2 | Bob | 1 |
| 3 | Charlie | 1 |
| 4 | Diana | 2 |


Question: List each employee alongside their manager's name.

sql
SELECT e.name AS employee, m.name AS manager
FROM employees e
LEFT JOIN employees m ON e.manager_id = m.id;


This is a self join - the same table joined to itself, aliased twice so SQL can treat it as two logical tables. Alice (the CEO) has manager_id = NULL, so she shows up with manager = NULL thanks to the LEFT JOIN.

⚠️ Interview follow-up: "Find all employees who earn more than their manager." This is a classic self-join + comparison question:

sql
SELECT e.name AS employee, e.salary, m.name AS manager, m.salary
FROM employees e
JOIN employees m ON e.manager_id = m.id
WHERE e.salary > m.salary;


Deeper follow-up: "Find the full management chain for a given employee, regardless of depth." A single self join can't do this - it only goes one level up. This needs a recursive CTE:

sql
WITH RECURSIVE chain AS (
SELECT id, name, manager_id
FROM employees
WHERE id = 4 -- start with Diana

UNION ALL

SELECT e.id, e.name, e.manager_id
FROM employees e
JOIN chain c ON e.id = c.manager_id
)
SELECT * FROM chain;


Recursive CTEs come up more than people expect for org charts, category trees, and dependency graphs. Worth practicing even if it feels unfamiliar at first.

Have you ever had to query an actual org chart or category tree at work? 👇
😁1
🎯 CODING CHALLENGE #9 - LRU Cache
Difficulty: Medium-Hard | Asked at: Amazon, Google, Meta

Design a Least Recently Used (LRU) cache with O(1) get and put operations.


cache = LRUCache(2)
cache.put(1, 1)
cache.put(2, 2)
cache.get(1) # returns 1, and marks 1 as recently used
cache.put(3, 3) # evicts key 2 (least recently used)
cache.get(2) # returns -1 (not found)


💡 Hint: This is the perfect combo problem - you need O(1) lookup (hash map) AND O(1) reordering/eviction (doubly linked list). Neither alone gets you there.

Solution:
python
class Node:
def __init__(self, key, val):
self.key = key
self.val = val
self.prev = None
self.next = None

class LRUCache:
def __init__(self, capacity):
self.capacity = capacity
self.cache = {}
self.head = Node(0, 0)
self.tail = Node(0, 0)
self.head.next = self.tail
self.tail.prev = self.head

def _remove(self, node):
node.prev.next = node.next
node.next.prev = node.prev

def _add_to_front(self, node):
node.next = self.head.next
node.prev = self.head
self.head.next.prev = node
self.head.next = node

def get(self, key):
if key not in self.cache:
return -1
node = self.cache[key]
self._remove(node)
self._add_to_front(node)
return node.val

def put(self, key, value):
if key in self.cache:
self._remove(self.cache[key])
node = Node(key, value)
self.cache[key] = node
self._add_to_front(node)

if len(self.cache) > self.capacity:
lru = self.tail.prev
self._remove(lru)
del self.cache[lru.key]


Complexity: O(1) time for both get and put, O(capacity) space.

Common mistake: Trying to use Python's built-in list to track recency order - list.remove() and re-inserting are O(n), which defeats the entire point. The doubly linked list is what makes removal from the middle O(1), because you don't need to search for the node - you already have a direct reference to it.

💡 Pro tip: in a real interview, mentioning OrderedDict in Python (which has built-in move_to_end()) is a great way to show you know the language deeply - but building it from scratch with a hash map + linked list is what interviewers actually want to see, since it proves you understand WHY it's O(1), not just that a library exists.

This is consistently rated one of the best "combines two data structures" interview questions. Have you built this before, or is this your first time seeing it? 👇
📄 RESUME ROAST #5

> "Software Engineer | Company XYZ | 2019 - Present
> • Wrote code for various projects
> • Fixed bugs
> • Attended daily standups
> • Participated in code reviews"

Roast time - what's the core problem across ALL four bullets? 👇

.
.
.

The roast: Every single bullet describes an ACTIVITY, not an OUTCOME. "Attended daily standups" is something literally everyone on the team does - it says nothing about YOUR specific contribution or impact, and takes up a bullet point that could've held something valuable.

The test for every resume bullet: could this exact sentence apply to any random person on the team, doing the bare minimum? If yes, cut it or rewrite it.

✅ Rewritten with the same underlying work, framed around outcomes:

> • Redesigned the checkout flow, reducing cart abandonment by 18%
> • Diagnosed and fixed a memory leak in the notification service, cutting server costs by $2K/month
> • Led code review standards adoption across a 6-person team, catching 30% more bugs pre-merge

Same person, same actual job - completely different resume. Numbers and outcomes aren't decoration, they're the entire point.

Look at your own resume - how many bullets describe activities vs. outcomes? Be brutally honest 👇
🏗️ SYSTEM DESIGN MONDAY #6 - Let's Design Instagram (Feed + Media at Scale)

Bigger system this week. Core requirements:

✅ Users post photos/videos
✅ Users follow other users
✅ Users see a feed of posts from people they follow
✅ Massive read traffic - feeds are viewed constantly, posts created far less often

The hardest question in this whole design: how do you GENERATE the feed?

🔹 Option A - Pull model (fan-out on read): When a user opens their feed, query posts from everyone they follow, merge, and sort by time.

[User requests feed] → [Query posts from all 500 people they follow] → [Merge + sort] → [Return]

Simple, but SLOW for users following many accounts - that query fans out wide every single time they open the app.

🔹 Option B - Push model (fan-out on write): When someone posts, immediately push that post into the precomputed feed of every follower.

[User posts] → [Push post into feed_cache for each of their 10K followers]

Feed reads become instant (just read your precomputed feed) - but this completely breaks down for celebrities with 50 million followers, since one post would mean 50 million writes.

✅ The real answer (hybrid): Push model for regular users, pull model for accounts above a follower threshold (celebrities). Merge the two at read time. This exact hybrid approach is used by real large-scale social platforms, and mentioning it shows you understand that there's rarely one clean solution at true scale - just the least-bad tradeoff for each case.

Media storage: Photos/videos themselves don't belong in your database - they go in object storage (like S3), with only the URL/reference stored in the database. A CDN (Content Delivery Network) then caches that media geographically close to users, so someone in Tokyo isn't fetching an image from a US-based server every time.


[App Server] → stores reference → [Database]
[App Server] → stores actual file → [Object Storage] → cached globally by → [CDN]


Which feed generation approach would you have guessed first, before reading the hybrid answer? 👇
🔍 GUESS THE OUTPUT #6
Language: Python

python
def outer():
x = 10
def inner():
print(x)
x += 1
inner()

outer()


Lock in your answer, then vote on the quiz below 👇
What happens when outer() runs?
Anonymous Quiz
33%
Prints 10
22%
Prints 11
33%
UnboundLocalError
11%
Prints None
❤3
🔍 GUESS THE OUTPUT #6 - full breakdown

python
def outer():
x = 10
def inner():
print(x)
x += 1
inner()

outer()


Answer: UnboundLocalError: local variable 'x' referenced before assignment

This one surprises a lot of people - it does NOT print 10. Here's why: because inner() assigns to x (x += 1), Python treats x as a LOCAL variable throughout the entire function the moment it sees any assignment to it, even before that line executes. So the print(x) line is trying to read a local x that hasn't been assigned yet.

Fixed version:
python
def outer():
x = 10
def inner():
nonlocal x
print(x)
x += 1
inner()


The nonlocal keyword tells Python "this x refers to the enclosing function's variable, not a new local one."

This is a genuinely tricky one - Python decides variable scope at compile time based on whether a name is assigned anywhere in the function, not based on execution order. Great interview question for testing real understanding of closures vs. just pattern-matching syntax.
⚠️ COMMON INTERVIEW MISTAKE #5 - Not Asking ANY Questions at the End

"Do you have any questions for me?" is not a courtesy formality - interviewers actively judge your answer to this, and "no, I think you covered everything" is a genuinely weak close to an interview.

Why it matters: it's your best remaining signal-generating opportunity, AND it shows genuine engagement rather than someone just trying to get through the process.

✅ Strong questions to have ready (tailor to who you're talking to):

To an engineer: "What's the most painful part of the codebase right now, and is there a plan to address it?"

To a manager: "How do you measure success for someone in this role after 6 months?"

To anyone: "What's something about working here that surprised you, in either a good or bad way?"

❌ Avoid questions Google can already answer (basic company facts, publicly available info) - it signals you didn't do basic homework.

❌ Avoid ONLY asking about perks/benefits/PTO in the first interview - save that for later rounds or the recruiter; asking it too early to your potential future teammates can look like priorities are misplaced.

Save at least 2-3 genuinely good questions for every interview. It's one of the highest-leverage, lowest-effort improvements you can make.

What's the best question you've ever asked (or been asked) at the end of an interview? 👇
🎯 CODING CHALLENGE #10 - Word Ladder (BFS Shortest Path)
Difficulty: Hard | Asked at: Google, Amazon, LinkedIn

Given beginWord, endWord, and a word list, find the length of the shortest transformation sequence, changing one letter at a time, where each intermediate word must exist in the word list.


Input: beginWord = "hit", endWord = "cog"
wordList = ["hot","dot","dog","lot","log","cog"]
Output: 5 ("hit" -> "hot" -> "dot" -> "dog" -> "cog")


💡 Hint: "Shortest transformation" is your biggest clue - this is shortest path in an unweighted graph, which means BFS, not DFS.

Solution:
python
from collections import deque

def ladder_length(begin_word, end_word, word_list):
word_set = set(word_list)
if end_word not in word_set:
return 0

queue = deque([(begin_word, 1)])
visited = {begin_word}

while queue:
word, steps = queue.popleft()
if word == end_word:
return steps

for i in range(len(word)):
for c in 'abcdefghijklmnopqrstuvwxyz':
next_word = word[:i] + c + word[i+1:]
if next_word in word_set and next_word not in visited:
visited.add(next_word)
queue.append((next_word, steps + 1))

return 0


Complexity: O(M² × N) time, where M is word length and N is the word list size - for each word, we try M positions × 26 letters, each generating an M-length string.

Common mistake: Reaching for DFS because it "feels" more natural for pathfinding - DFS can find A path, but has no guarantee it finds the SHORTEST one without exploring everything. The moment you see "shortest" or "minimum steps" in unweighted graph problems, that's your signal: BFS.

This is one of those problems where recognizing the underlying pattern (shortest path = BFS) matters far more than clever tricks - the "graph" here isn't even given to you explicitly, you have to realize that words are nodes and one-letter-difference is an edge.

Did you recognize this as a graph problem right away, or did it take a second to see it? 👇
📚How I’d Prepare for an IT Interview Before I Even Applied

If you're applying for technical roles, don't prepare for interviews and certifications as two completely separate things.
Use them together.

1️⃣ Start with the role

🔹 roadmap.sh
Pick your path and identify the technologies you actually need.
Data Engineer, DevOps, Cloud, Cybersecurity, Backend, etc.

2️⃣ Find the questions you'll actually face

🔹 IT Interview Questions
It has role-specific collections across Cloud, Data/BI, Cybersecurity, Software/DevOps and many more.

Don't memorize the answers. Use the questions to find what you don't understand.

3️⃣ Go deeper on weak areas

Some of the best free technical material isn't packaged as "interview prep."

🔹 MIT Missing Semester
🔹 Google SRE Books
🔹 Full Stack Deep Learning
🔹 DataTalksClub

These are the kind of resources worth keeping long after the interview.

4️⃣ If the role requires cloud, prepare for the certification side too

This is where certification material becomes useful even if you aren't planning to take the exam.

🔹 Free training & study materials

This is a platform to learn different materials including AWS, Microsoft, CompTIA and other cloud/IT certification resources.

And always keep the official documentation nearby:
AWS
Azure
Google Cloud

5️⃣ If You Need actual certification practice
🔹 Exam practice

Use this specifically when you're preparing for a certification. I wouldn't use it as an interview-question substitute.

For official practice, also check:
🔹 AWS Skill Builder
🔹 Microsoft Learn

6️⃣ The final test
Close everything. Pick 10 questions. Answer them out loud.

Then take one architecture problem and explain:
requirements → architecture → trade-offs → failure scenarios → scaling → cost

If you can't explain your answer without looking something up, you've found what to study next.

Don't collect resources. Build a preparation loop:
Learn → practice → identify gaps → study → explain → repeat.

That's what actually gets you interview-ready.
❤2
🗣️ BEHAVIORAL INTERVIEW #5 - "Tell Me About a Time You Disagreed With a Decision"

Similar to the conflict question, but this one specifically probes: can you push back on authority respectfully, and can you also let go gracefully if you don't get your way?

✅ The structure that works:

1. What was the decision, and why did you disagree?
2. How did you raise your concern (privately? with data? at the right time?)
3. What was the outcome - did they change course, or did you disagree and commit?
4. How did you handle it either way?

Example:
"My manager decided to launch a feature without A/B testing it first, to hit a deadline. I disagreed, so I put together a quick doc showing the risk based on a similar past launch that had gone poorly without testing. He read it, but ultimately decided the deadline pressure from a client commitment outweighed the risk. I made sure my concerns were documented, then fully committed to making the launch as smooth as possible - added extra monitoring and a fast rollback plan just in case. It ended up working out fine, but even if it hadn't, I'd rather have raised the concern clearly once than either stayed silent or kept relitigating it after the decision was made."

This shows: you can think critically and push back, you use evidence rather than just opinion, and - critically - you know how to "disagree and commit" once a decision is made, which is a trait senior leaders explicitly look for.

Have you ever disagreed with a decision and had to commit to it anyway? How'd that feel? 👇