Tagged articles
interview question
25 articles · Page 1 of 1
This article analyzes whether try-catch blocks should be placed inside or outside for loops in Java, demonstrating how placement affects loop continuation after exceptions, examining JVM exception table mechanics, and comparing memory performance implications.
Exception HandlingJVMJava
0 likes · 6 min read

The article analyzes why context compression in AI agents loses tool call history, causing duplicate executions, and presents five architectural fixes: an independent action ledger, idempotent interception with signatures, explicit compression prompts, external storage with retrieval, and hierarchical summarization.
AI agentsAction LedgerContext Management
0 likes · 10 min read

This article explains that listen() merely marks a socket as passive and initializes kernel queues; without it, servers reject incoming SYN packets with RST, yet client-side connect() and TCP simultaneous open can establish connections without ever calling listen().
TCPconnectinterview question
0 likes · 7 min read

This article explains the critical behavioral difference when placing try-catch inside versus outside a for loop: outside placement terminates the loop on exception, while inside allows continuation. It also analyzes performance implications, showing negligible overhead when no exceptions occur but increased memory consumption if many iterations throw exceptions, and details the JVM exception table mechanics that underlie this behavior.
Exception HandlingJavabytecode
0 likes · 6 min read

The article defines a time slice (time quantum) as the fixed CPU interval allocated to each ready process in a time‑sharing scheduler, explains its role in round‑robin and CFS algorithms, discusses size trade‑offs, Linux implementation details, context‑switch costs, and typical interview follow‑up questions.
CFSOS schedulingcontext switch
0 likes · 9 min read

The article presents a classic interview problem of locating the unique element in an integer array where every other value appears twice, and walks through three Java 17 implementations—brute‑force double loop, HashMap counting, and a bitwise XOR trick—detailing their time and space trade‑offs and practical considerations.
AlgorithmBitwise XORHashMap
0 likes · 8 min read

This article explains why the destructuring statement var [a, b] = {a:1, b:2} throws a TypeError, explores the iterator protocol and Symbol.iterator, and shows how redefining Object.prototype[Symbol.iterator] enables the object to be iterable so the destructuring succeeds.
DestructuringIterator ProtocolJavaScript
0 likes · 6 min read
![How to Make var [a, b] = {a:1, b:2} Work in JavaScript?](https://wsrv.nl/?url=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FFCeL9x2FWkfLlUbiccJdtd1tIuodHiaa62oJGPl8N8sicEjOuicfMdUszolDtPFuN4H43U0YLh0Z8SQvEx0t9h7JpsiaYWbqbApdKfytRRYqqUOk%2F0%3Fwx_fmt%3Djpeg)
The article explains why the destructuring statement var [a, b] = {a: 1, b: 2} throws a TypeError, details the iterator requirement for the left‑hand side, and shows how to add a Symbol.iterator method to Object.prototype so any object becomes iterable and the assignment succeeds.
DestructuringIterator ProtocolJavaScript
0 likes · 6 min read
![How to Make var [a, b] = {a: 1, b: 2} Work in JavaScript?](https://wsrv.nl/?url=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FFCeL9x2FWkfLlUbiccJdtd1tIuodHiaa62oJGPl8N8sicEjOuicfMdUszolDtPFuN4H43U0YLh0Z8SQvEx0t9h7JpsiaYWbqbApdKfytRRYqqUOk%2F0%3Fwx_fmt%3Djpeg)
The article critiques absurd interview questions, then presents a practical Java solution for compressing strings by replacing consecutive characters with their counts, explains the algorithm’s O(n) time and O(1) extra space, discusses edge cases like multi‑digit counts and Unicode handling, and offers implementation tips.
AlgorithmJavaString Compression
0 likes · 6 min read

This article breaks down the interview question "Can TCP and UDP use the same port?" by examining protocol-level port spaces, client‑side TCP and UDP port sharing rules, server‑side TCP reuse with SO_REUSEADDR, and UDP reuse with SO_REUSEPORT, complete with code examples and practical implications.
Port SharingSO_REUSEADDRSO_REUSEPORT
0 likes · 17 min read

The article examines an interview question about storing 2 billion phone numbers, explains why int cannot hold 11‑digit numbers, advocates using VARCHAR(20) for flexibility and data integrity, and outlines common pitfalls and best practices for database design.
BIGINTDatabase DesignMySQL
0 likes · 8 min read

This article explains the LazyMan interview problem, demonstrates how to build a JavaScript function supporting chainable sleep, eat, and sleepFirst methods using task queues, and provides step‑by‑step code implementations with explanations and visual results.
ChainableJavaScriptLazyMan
0 likes · 7 min read

An interview question explores the fastest way to transfer a 1,000 TB dataset from Nanjing to Beijing, comparing high‑speed network links, their costs and transfer times, with a practical, low‑cost solution of physically shipping hard‑drive containers by high‑speed rail.
Data TransferNetwork Bandwidthhard drive shipping
0 likes · 4 min read

The article first presents a detailed analysis of Tencent's 2024 campus recruitment salary packages for various programmer offers, then introduces a classic algorithmic challenge of reversing a linked list in groups of k nodes, providing step‑by‑step explanation and a complete Java implementation.
Javadata structuresinterview question
0 likes · 9 min read

This article walks through a Python interview problem that extracts level‑up events from a log file, demonstrating step‑by‑step data cleaning, JSON parsing, and aggregation with pandas, and provides the complete, ready‑to‑run code plus visual explanations.
Code TutorialPandasinterview question
0 likes · 5 min read

Many interviewees expect the Java expression ‘a == b’ to be false and ‘c == d’ true when using Integer objects, but due to the Integer cache range and JVM settings, both comparisons can actually return true, a nuance explained through source code analysis and cache configuration.
Integer cachingJVMJava
0 likes · 6 min read

This article explains the classic water‑jug interview problem using two cups of 9 L and 15 L, derives the reachable volumes via greatest‑common‑divisor logic, and provides complete C++ code to determine feasibility and output the pouring steps for any target volume.
AlgorithmGCDSimulation
0 likes · 6 min read

This article walks through a classic interview problem of locating common URLs in two massive files, explains why a naïve O(m·n) approach fails, and presents a scalable solution using hash‑based divide‑and‑conquer and file partitioning techniques.
Divide and ConquerURL deduplicationbig data
0 likes · 6 min read


JavaEdgeOct 27, 2021 · Interview Experience
This article explains how to determine whether a singly linked list contains a cycle using three approaches—brute‑force, hash‑marking, and the optimal fast‑and‑slow pointer technique—providing Go and C++ implementations that achieve minimal time and O(1) space complexity suitable for a Tencent interview.
AlgorithmC++Go
0 likes · 6 min read

This article explains the classic House Robber interview question, detailing the problem constraints, illustrating why a naive alternating‑house approach fails, and presenting a clear dynamic‑programming solution with recurrence, base cases, and a concise code example.
AlgorithmDPdynamic programming
0 likes · 5 min read

This article explains a Java interview puzzle by analyzing how the JVM stack frame handles variable assignments and increment operators, step‑by‑step showing the effects of i = i++, i = ++i, and a complex expression i + ++i * i++ on variable values.
JVMJavaincrement operators
0 likes · 4 min read

This article presents a JavaScript solution for locating the maximum element in a bitonic (first increasing then decreasing) array, explaining that the problem is a variant of binary search and providing a complete implementation using a binary‑search‑based algorithm.
AlgorithmJavaScriptbinary search
0 likes · 3 min read

The article examines a Python interview question where a lambda list inside a loop unexpectedly prints 6 for all elements due to late binding in closures, explains the underlying mechanism, and presents four practical solutions—including default‑argument binding, functools.partial, generator expressions, and yield‑based approaches—to achieve the intended 0, 2, 4, 6 output.
closuresinterview questionlambda
0 likes · 5 min read

This article presents a notoriously tricky Java interview problem, walks through its multithreaded code, explains the possible outputs, and then expands into a comprehensive discussion of thread‑safety concepts, synchronization mechanisms, and best practices for writing safe concurrent Java programs.
JavaSynchronizedinterview question
0 likes · 14 min read

Python’s chain assignment offers concise multiple-variable assignment, but its left-to-right evaluation differs from C’s right-to-left value-semantic approach, leading to surprising results in interview questions; understanding the distinction between value-semantic and object-semantic languages helps avoid subtle bugs.
PythonValue Semanticschain assignment
0 likes · 5 min read
