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
ExperiencesCoaching
New
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
Get started
Triangle Validity Verification
00:00
5 left

Triangle Validity Verification

EasyPython

Problem

Photon's layout validation service receives three arrays containing corresponding side lengths. For each index, determine whether the three lengths can form a valid non-degenerate triangle.

Return a string array containing "YES" for valid triangles and "NO" otherwise, preserving the input order.

Formal Specification

Implement verify_triangles(a, b, c):

  • Input: Three integer arrays a, b, and c of equal length. For index i, the candidate sides are a[i], b[i], and c[i].
  • Output: A string array of the same length. The result at index i is "YES" if the three sides form a valid triangle, otherwise "NO".

A valid triangle must have three positive side lengths, and the sum of any two sides must be strictly greater than the third side.

Constraints

  • 1 <= a.length = b.length = c.length <= 10^5
  • -10^9 <= a[i], b[i], c[i] <= 10^9
  • Return results in the same order as the input triples
  • A valid triangle requires strictly positive side lengths

Function Signature

def verify_triangles(a, b, c):
Interviewer

Your question is Triangle Validity Verification. 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.
Code
Sign up free to run your codeLog inLn 2
Run your code to see test output here.