Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
MNIST Digits Sum Network
00:00
5 left

MNIST Digits Sum Network

HardPython

Problem

Build a deep learning network that sums single digits from the MNIST dataset; the summation must be performed by the network itself.

Implement build_digit_sum_network(input_shape) using only the Python standard library. Return a deterministic architecture specification for two grayscale MNIST images per sample. The specification must use one shared digit encoder, combine the two encoded representations, and produce one scalar output per sample without an explicit arithmetic addition operation.

input_shape is [batch_size, 2, 1, 28, 28]. Return a JSON-compatible dictionary containing the input shape, output shape, shared-encoder flag, explicit-addition flag, maximum supported target, and ordered layer names.

Constraints

  • input_shape has exactly five integers
  • input_shape must have the form [batch_size, 2, 1, 28, 28]
  • 1 <= batch_size
  • The network supports two digits per sample
  • The largest possible target is 18
  • The returned value must contain only JSON-compatible data

Function Signature

def build_digit_sum_network(input_shape):
Interviewer

Your question is MNIST Digits Sum Network. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.