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
Simple LeetCode String Checks
00:00
5 left

Simple LeetCode String Checks

EasyPython

Problem

How would you solve easy LeetCode-style problems like checking if a string is a palindrome or if two strings are anagrams?

Implement string_checks(s, t) to return an object containing is_palindrome for s and are_anagrams for s and t; comparisons are case-sensitive and include every character. For example, string_checks("level", "velle") returns { "is_palindrome": true, "are_anagrams": true }, while string_checks("hello", "world") returns { "is_palindrome": false, "are_anagrams": false }. Inputs contain 0 to 1,000 characters and may include letters, digits, spaces, or punctuation.

Constraints

  • 0 <= len(s), len(t) <= 1,000
  • Strings may contain letters, digits, spaces, and punctuation
  • Comparisons are case-sensitive
  • Whitespace and punctuation are treated as ordinary characters

Function Signature

def string_checks(s, t):
Interviewer

Your question is Simple LeetCode String Checks. 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.