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
- Последний пост
- 15 авг.
- Последнее чтение
- 15 авг.
- Постов за неделю
- 13
- Всего постов
- 28
- Тип
- открытый
- Язык
- und
- Категория
- Технологии (по похожим)
- В каталоге с
- 12 авг.
- 1/24сутки в ленте
- 141
- 1/48двое суток
- 161
- 1/72трое суток
- 174
Оценка по просмотрам недавних постов: пост набирает почти всё за первые сутки.
Посты
видео или голосовое, без подписи
видео или голосовое, без подписи
🐛 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? 👇
🕵️ 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? 👇
🗣️ 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 😉
🎯 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? 👇
видео или голосовое, без подписи
видео или голосовое, без подписи
👋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.
⚠️ 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? 😅
💰 SALARY NEGOTIATION #4 - Negotiating Equity, Not Just Salary Especially at startups, equity can be worth more than the base salary difference - but most candidates don't know what questions to ask. ✅ Questions to ask before accepting any equity offer: 1. "How many total shares are outstanding, fully diluted?" (Your number of shares means nothing without this - 10,000 shares out of 10 million is very different from 10,000 out of 100 million) 2. "What's the strike price, and what's the most recent 409A valuation?" (This tells you the real cost to exercise, and a rough sense of current value) 3. "What's the vesting schedule?" (Standard is 4 years with a 1-year cliff - meaning you get nothing if you leave before year one) 4. "Is there a post-termination exercise window longer than 90 days?" (Standard 90-day windows force ex-employees to either pay to exercise immediately or lose their vested equity - some companies now offer extended windows, which is a real, valuable perk to ask about) If a recruiter can't answer these clearly, that's itself useful information about the company's transparency. Bottom line: never treat "$X in equity" as a clean number to compare across offers without understanding the mechanics behind it. Has anyone here actually had equity turn into real money? Tell us about it 👀
🧠 EDUCATIONAL CS #4 - Trees, Graphs, and the Difference That Matters A tree is just a graph with two extra rules: no cycles, and exactly one path between any two nodes. Tree: Graph (with cycle): 1 1 --- 2 / \ | | 2 3 4 --- 3 Why does this distinction matter in interviews? 🔹 In a tree, you never need to track visited nodes during traversal - since there are no cycles, you literally cannot revisit a node. 🔹 In a graph, you MUST track visited nodes, or you risk infinite loops. python # Graph DFS - visited set is NOT optional def dfs(graph, node, visited=None): if visited is None: visited = set() if node in visited: return visited.add(node) for neighbor in graph[node]: dfs(graph, neighbor, visited) Forgetting the visited set is one of the most common graph-traversal bugs in interviews - code that works perfectly on the example tree-like input, then infinite-loops the moment the interviewer adds one cycle to the test case (which they often do specifically to check this). Also worth knowing cold: BFS finds the SHORTEST path in an unweighted graph; DFS does not guarantee that. If a problem says "shortest," that's your signal to reach for BFS. Quick one: is a linked list technically a tree, a graph, both, or neither? 👇
🏗️ SYSTEM DESIGN MONDAY #5 - Let's Design TinyURL Time for our first full end-to-end design. Requirements: ✅ Given a long URL, generate a short one ✅ Given a short URL, redirect to the original ✅ High read traffic (redirects happen constantly), lower write traffic (new URLs created less often) Step 1 - the core challenge: how do we generate a short, unique code for each URL? Option A: Hash the URL (like MD5) and take the first 7 characters. Risk: collisions, requires checking uniqueness. Option B (better): use an auto-incrementing ID from the database, then convert it to base62 (a-z, A-Z, 0-9). ID 125 becomes something like "cb" - dramatically shorter, always unique by construction. Step 2 - the architecture: [Client] → [Load Balancer] → [App Servers] → [Cache] → [Database] (hot URLs cached for fast redirects) Step 3 - the schema: urls +--------+--------------------------+---------------------+ | id | short_code | long_url | created_at | +--------+------------+-------------+---------------------+ | 125 | cb | example.com | 2024-01-01 10:00:00 | Step 4 - the follow-ups interviewers actually ask: 🔹 "What if two servers generate the same ID at the same time?" → Use a centralized ID generator service, or database auto-increment, or a distributed ID scheme like Twitter's Snowflake. 🔹 "How do you handle a URL that goes viral overnight?" → This is exactly why we cache hot URLs - the cache absorbs the read spike so the database doesn't get hammered. 🔹 "Should short codes expire?" → Product decision, not purely technical - worth explicitly asking your interviewer this instead of assuming. The key skill being tested isn't "do you know TinyURL" - it's whether you can reason from requirements to architecture out loud, and handle the follow-up curveballs. If you were designing this, would you go with hash-based or counter-based short codes? 👇
🔍 GUESS THE OUTPUT #5 - full breakdown python print(bool("False")) print(bool("")) print(bool([False])) print(bool(0.0)) Answers: True False True False Breakdown: 1️⃣ "False" is a non-empty string - any non-empty string is truthy, REGARDLESS of its content. The string literally saying "False" doesn't matter. 2️⃣ "" is an empty string - falsy. 3️⃣ [False] is a list containing one element - and non-empty lists are always truthy, regardless of what's inside them. 4️⃣ 0.0 is falsy, just like 0. This one trips up even experienced developers because #1 and #3 look like they "should" be False at a glance, but Python's truthiness rules only care about emptiness/zero-ness of the container itself, never its contents. Which one did you get wrong, if any? Be honest 😄
видео или голосовое, без подписи
🔍 GUESS THE OUTPUT #5 Language: Python python print(bool("False")) print(bool("")) print(bool([False])) print(bool(0.0)) Lock in your answer, then vote on the quiz below 👇
📊 SQL SATURDAY #5 - Window Functions (The Interview Differentiator) If GROUP BY collapses rows, window functions let you calculate aggregates WITHOUT collapsing them - you keep every row, plus a calculated value alongside it. This is one of the clearest signals of SQL seniority in interviews. sales +----+------------+--------+ | id | department | amount | +----+------------+--------+ | 1 | Eng | 100 | | 2 | Eng | 200 | | 3 | Sales | 150 | | 4 | Sales | 300 | Question: Show each sale alongside the total for its department, without collapsing rows. sql SELECT id, department, amount, SUM(amount) OVER (PARTITION BY department) AS dept_total FROM sales; +----+------------+--------+------------+ | id | department | amount | dept_total | +----+------------+--------+------------+ | 1 | Eng | 100 | 300 | | 2 | Eng | 200 | 300 | | 3 | Sales | 150 | 450 | | 4 | Sales | 300 | 450 | PARTITION BY is like GROUP BY, but it doesn't collapse the rows - every row keeps its own identity while gaining group-level context. Another classic interview favorite - ranking within groups: sql SELECT id, department, amount, RANK() OVER (PARTITION BY department ORDER BY amount DESC) AS dept_rank FROM sales; ⚠️ Interview trap: RANK() vs DENSE_RANK() vs ROW_NUMBER() - know the difference cold: 🔹 ROW_NUMBER() - always unique, 1,2,3,4, even with ties 🔹 RANK() - ties share a rank, but the NEXT rank skips (1,1,3,4) 🔹 DENSE_RANK() - ties share a rank, next rank does NOT skip (1,1,2,3) Interviewers love asking you to explain this exact difference, then predict output on a tied dataset. Which of the three ranking functions do you use most in your actual job? 👇
📄 RESUME ROAST #4 > "2020-2023: Software Engineer > 2023-2024: Senior Software Engineer > 2024-Present: Software Engineer II" Spot the issue before I explain 👇 . . . The roast: This looks like a demotion, and recruiters WILL notice and wonder about it - even if "Software Engineer II" is actually a level ABOVE "Senior Software Engineer" at your specific company (title inflation and naming varies wildly between companies). The resume doesn't explain that, so it just reads as a step backward, and most recruiters won't take the time to ask - they'll just quietly deprioritize the resume. ✅ The fix: add a one-line clarifying note, or better, standardize your titles to reflect actual seniority level consistently: > "2024-Present: Software Engineer II (Senior-equivalent level at [Company]'s leveling structure)" Or simply pick the title that most clearly communicates your actual seniority to an outside reader, even if it's not your exact internal title - as long as it's honest and defensible if asked about in an interview. Never assume the reader knows your company's internal quirks. Assume zero context and write for a stranger. Anyone else dealt with a confusing title change like this? 👇
🎯 CODING CHALLENGE #7 - Kth Largest Element in an Array Difficulty: Medium | Asked at: Facebook, Amazon, Google Input: nums = [3,2,1,5,6,4], k = 2 Output: 5 💡 Hint: Sorting works but is O(n log n). Can you do better with a heap that only ever holds k elements? Solution (min-heap approach): python import heapq def find_kth_largest(nums, k): heap = nums[:k] heapq.heapify(heap) for num in nums[k:]: if num > heap[0]: heapq.heapreplace(heap, num) return heap[0] Complexity: O(n log k) time, O(k) space - much better than sorting when k is small relative to n. Common mistake: Using a max-heap of the FULL array (heapifying all n elements, then popping k times) - this works, but it's a weaker answer. Building a min-heap of just size k and comparing incoming elements against the smallest kept element is the optimization interviewers are hoping to see. Alternative: Quickselect gets this down to average O(n) time, though worst case O(n²) - a great follow-up to mention if you want to show extra depth. Do you know Quickselect, or is the heap approach your default here? 👇
🕵️ RECRUITER SECRETS #4 - What Actually Happens After Your Interview Ever wondered what happens the moment you leave that Zoom call? Here's the real process at most mid-to-large companies: 1️⃣ Each interviewer independently writes feedback and a rating (usually a scale like "Strong Hire / Hire / No Hire / Strong No Hire") before discussing with anyone else - this is intentional, to avoid groupthink. 2️⃣ These are compiled into a packet for a hiring committee or debrief meeting - often people who never even met you. 3️⃣ One "no hire" from a single round can sometimes be overridden by strong signal elsewhere, but a "strong no hire" is very difficult to recover from, even with great other rounds. 4️⃣ The single biggest factor in close calls: whether interviewers can point to specific examples in their notes, not vague impressions. This is why articulating your thinking clearly matters so much - a vague "good vibes" interview generates a vague, easily-overruled recommendation. Here's the actionable part: at the end of every round, briefly summarize what you just demonstrated. "Just to recap, I approached this with a hash map for O(1) lookups, handled the edge cases we discussed, and we walked through the complexity together." This gives the interviewer an easy, concrete sentence to write down - literally doing their job for them. Did this change how you think about what happens after you leave the interview? 👇