Coding and Debugging Assessments - Comprehensive Technical Evaluation | Hivemind
Coding and Debugging Assessments
Comprehensive Technical Evaluation
Assess candidates with coding and debugging challenges across 7 languages and 22 frameworks.
Coding Assessment · Backend Engineer
Problem: JavaScript
Two Sum
Given an array of integers nums and a target, return the indices of the two numbers that add up to the target.
Example
nums = [2, 7, 11, 15]
target = 9
→ [0, 1]
O(n) expected
solution.js
function twoSum(nums, target) {
const seen = new Map();
for (let i = 0; i < nums.length; i++) {
const need = target - nums[i];
if (seen.has(need))
return [seen.get(need), i];
seen.set(nums[i], i);
}
}
Test results
| Test Case | Result |
|---|---|
| twoSum([2, 7, 11, 15], 9) | pending |
| twoSum([3, 2, 4], 6) | pending |
| twoSum([3, 3], 6) | pending |