Tagged articles

Interview Question

19 articles · Page 1 of 1
IoT Full-Stack Technology
IoT Full-Stack Technology
Jun 18, 2026 · Fundamentals

How to Make var [a, b] = {a:1, b:2} Work in JavaScript?

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.

DestructuringInterview QuestionIterator Protocol
0 likes · 6 min read
How to Make var [a, b] = {a:1, b:2} Work in JavaScript?
IoT Full-Stack Technology
IoT Full-Stack Technology
Jun 17, 2026 · Interview Experience

How to Make var [a, b] = {a: 1, b: 2} Work in JavaScript?

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.

DestructuringInterview QuestionIterator Protocol
0 likes · 6 min read
How to Make var [a, b] = {a: 1, b: 2} Work in JavaScript?
IT Services Circle
IT Services Circle
Aug 25, 2025 · Fundamentals

How to Efficiently Compress Strings in Java: Interview‑Ready Solution

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.

Interview QuestionJavaString Compression
0 likes · 6 min read
How to Efficiently Compress Strings in Java: Interview‑Ready Solution
Liangxu Linux
Liangxu Linux
May 14, 2025 · Fundamentals

Can TCP and UDP Share the Same Port? A Deep Dive into Port Mechanics

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.

Interview QuestionNetwork ProgrammingPort Sharing
0 likes · 17 min read
Can TCP and UDP Share the Same Port? A Deep Dive into Port Mechanics
JavaEdge
JavaEdge
Oct 27, 2021 · Interview Experience

Detecting a Cycle in a Singly Linked List – Fast & Slow Pointer Solution for Tencent Interview

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.

C++GoInterview Question
0 likes · 6 min read
Detecting a Cycle in a Singly Linked List – Fast & Slow Pointer Solution for Tencent Interview
NiuNiu MaTe
NiuNiu MaTe
Oct 27, 2021 · Fundamentals

Master the House Robber Problem with Dynamic Programming

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.

DPInterview Questionalgorithm
0 likes · 5 min read
Master the House Robber Problem with Dynamic Programming
Programmer DD
Programmer DD
Jan 9, 2019 · Fundamentals

How to Find the Peak in a Bitonic Array Using Binary Search

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.

Binary SearchInterview QuestionJavaScript
0 likes · 3 min read
How to Find the Peak in a Bitonic Array Using Binary Search
MaGe Linux Operations
MaGe Linux Operations
Aug 20, 2018 · Fundamentals

Why Does This Python Lambda Loop Print 6 Every Time? Mastering Late Binding

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.

Interview QuestionLambdaclosures
0 likes · 5 min read
Why Does This Python Lambda Loop Print 6 Every Time? Mastering Late Binding
AI Cyberspace
AI Cyberspace
Dec 7, 2017 · Fundamentals

Why Python’s Chain Assignment Can Trip You Up – Understanding Value vs Object Semantics

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.

Interview QuestionPythonchain assignment
0 likes · 5 min read
Why Python’s Chain Assignment Can Trip You Up – Understanding Value vs Object Semantics