Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
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 feedbackSuccess 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
Predicting Humidity with Nonlinear Methods
00:00
5 left

Predicting Humidity with Nonlinear Methods

MediumSQL · PostgreSQL

Problem

Humidity prediction: fit a model to predict missing humidity readings; any non-linear regression or pandas interpolate passes the MSE-based tests

Asked in the HackerRank stage. Q3. Using the PostgreSQL tables provided, calculate linear interpolations for missing readings that have valid observed readings before and after them.

Output

  1. Return one row per interpolatable missing reading with sensor_id, sensor_name, reading_time, and predicted_humidity.
  2. Exclude missing readings without valid observations on both sides.
  3. Order by sensor_id, then reading_time.

Schema

humidity_readings
ColumnTypeDescription
reading_idPKINTUnique humidity reading identifier
sensor_idINTSensor that recorded the reading
reading_timeTIMESTAMPTimestamp of the reading
humidityNUMERIC(5,2)Observed relative humidity percentage
sensors
ColumnTypeDescription
sensor_idPKINTUnique sensor identifier
sensor_nameVARCHAR(100)Human-readable sensor name
locationVARCHAR(100)Sensor deployment location
Tableshumidity_readingssensors
Interviewer

Your question is Predicting Humidity with Nonlinear Methods. Start with the requirements and the two tables 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.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.