Voice AI Mock Interviewerfor software engineering

Practice coding, system design & behavioural interviews with a real-time AI recruiter.

30 free minutes credits. No payment required.
mockq.io/interview/two-sum
MockQ12:41
Problem

1. Two Sum

Easy

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

Example 1:

Input: nums = [2,7,11,15], target = 9

Output: [0,1]

Because nums[0] + nums[1] == 9, we return [0, 1].

Example 2:

Input: nums = [3,2,4], target = 6

Output: [1,2]

Example 3:

Input: nums = [3,3], target = 6

Output: [0,1]

Constraints:

  • 2 ≤ nums.length ≤ 10⁴
  • -10⁹ ≤ nums[i] ≤ 10⁹
  • -10⁹ ≤ target ≤ 10⁹
  • Only one valid answer exists.
Python
Loading editor…
MockQ
MMark
Scratchpad

need = target - n
seen before? return both
O(n) time, O(n) space

Questions sourced from real interviews at
Netflix
Apple
Google
Meta
Amazon
How it works

Four steps from picking a problem to knowing where you stand.

mockq.io/practice
mockq.io/interview/two-sum
MockQ12:41
Problem

1. Two Sum

Easy

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

Example 1:

Input: nums = [2,7,11,15], target = 9

Output: [0,1]

Because nums[0] + nums[1] == 9, we return [0, 1].

Example 2:

Input: nums = [3,2,4], target = 6

Output: [1,2]

Example 3:

Input: nums = [3,3], target = 6

Output: [0,1]

Constraints:

  • 2 ≤ nums.length ≤ 10⁴
  • -10⁹ ≤ nums[i] ≤ 10⁹
  • -10⁹ ≤ target ≤ 10⁹
  • Only one valid answer exists.
Python
Loading editor…
MockQ
MMark
Scratchpad

need = target - n
seen before? return both
O(n) time, O(n) space

mockq.io/scorecard/1
mockq.io/stats

Bridging the gap between knowing the answer and delivering it under pressure.

FeatureFinal Round AIinterview­ing.ioMockQ
Real-time AI Voice Interviewer
Sub-2000ms Conversational Latency
Edge Case & Assumption Verification—
Live Code Execution & Testing—
Multi-Language Support—
FAANG Interview Questions—
Structured Rubric Scoring——
  • Yes
  • Partial
  • No
Pricing

Start free. Pay only for the minutes you use.

Free

$0USD / month

  • 30 free credits per month (1 credit = 1 interview minute)
  • Practice problem library
  • Rubric-scored feedback
  • $0.15 / min credit purchase rate
Interview for free

Pro

$20USD / month

  • 120 free credits per month (1 credit = 1 interview minute)
  • Practice problem library
  • Rubric-scored feedback
  • $0.10 / min credit purchase rate
Start subscription

Find the gaps now, not in the job interview.

Start a free interview30 free minutes credits. No payment required.