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
Complex Coding Set
00:00
5 left

Complex Coding Set

HardPython

Problem

As part of a Luxoft engineering assessment, implement four independent algorithms in one Python function. Return the required result for each task: find a pair summing to a target, merge overlapping intervals, find the longest substring without repeated characters, and determine whether two strings are anagrams.

Formal Specification

Implement solve_all(nums, target, intervals, s, t). Return a dictionary with these keys:

  1. two_sum: the zero-based indices of the unique pair in nums whose values sum to target, or [] if no pair exists.
  2. merge_intervals: all overlapping intervals merged and sorted by start time.
  3. longest_substring: the length of the longest substring of s containing no repeated characters.
  4. valid_anagram: true if s and t contain the same characters with the same frequencies, otherwise false.

Intervals are represented as two-element lists [start, end]. Treat strings as case-sensitive and compare every character, including spaces and punctuation.

Constraints

  • 2 <= len(nums) <= 10^5
  • -10^9 <= nums[i], target <= 10^9
  • 0 <= len(intervals) <= 10^5
  • Each interval has exactly two integers and start <= end
  • 0 <= len(s), len(t) <= 10^5
  • At most one valid two-sum pair exists
  • String comparison is case-sensitive and includes spaces and punctuation

Function Signature

def solve_all(nums, target, intervals, s, t):
Interviewer

Your question is Complex Coding Set. 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.