PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Boston

Implement palindrome check and valid parentheses

Last updated: Mar 29, 2026

Quick Overview

This question evaluates string-processing skills, algorithmic reasoning, and attention to edge cases by asking for a palindrome detector and a parentheses-sequence validator.

  • easy
  • Boston
  • Coding & Algorithms
  • Data Scientist

Implement palindrome check and valid parentheses

Company: Boston

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

You have **20–25 minutes per problem**. Implement the following two functions and be prepared to explain your approach and **time/space complexity**. ## Problem 1 — Palindrome Check Write a function that determines whether a given string is a palindrome. - A string is a palindrome if it reads the same forward and backward. - Compare characters **exactly as they appear** (no case folding and no ignoring punctuation/whitespace unless you explicitly state and implement it). **Function signature (example):** - `bool is_palindrome(s: str)` **Input:** - `s`: a string (may be empty) **Output:** - `true` if `s` is a palindrome, otherwise `false` **Examples:** - `"abba" -> true` - `"abc" -> false` - `"" -> true` ## Problem 2 — Valid Parentheses Sequence Write a function that checks whether a string containing only parentheses characters is valid. A string is **valid** if: 1. Every opening bracket has a corresponding closing bracket of the same type. 2. Brackets close in the correct order. Assume the allowed bracket types are: `()`, `[]`, `{}`. **Function signature (example):** - `bool is_valid_parentheses(s: str)` **Input:** - `s`: a string consisting only of characters in `()[]{} ` (may be empty) **Output:** - `true` if `s` is valid, otherwise `false` **Examples:** - `"()" -> true` - `"([]){}" -> true` - `"(]" -> false` - `"([)]" -> false` - `"" -> true` ## Documentation requirement For each function, include a docstring with: - **Description** - **Inputs/Outputs** - **Callouts** (assumptions, edge cases, complexity)

Quick Answer: This question evaluates string-processing skills, algorithmic reasoning, and attention to edge cases by asking for a palindrome detector and a parentheses-sequence validator.

Boston logo
Boston
Jan 17, 2026, 12:00 AM
Data Scientist
Technical Screen
Coding & Algorithms
5
0

You have 20–25 minutes per problem. Implement the following two functions and be prepared to explain your approach and time/space complexity.

Problem 1 — Palindrome Check

Write a function that determines whether a given string is a palindrome.

  • A string is a palindrome if it reads the same forward and backward.
  • Compare characters exactly as they appear (no case folding and no ignoring punctuation/whitespace unless you explicitly state and implement it).

Function signature (example):

  • bool is_palindrome(s: str)

Input:

  • s : a string (may be empty)

Output:

  • true if s is a palindrome, otherwise false

Examples:

  • "abba" -> true
  • "abc" -> false
  • "" -> true

Problem 2 — Valid Parentheses Sequence

Write a function that checks whether a string containing only parentheses characters is valid.

A string is valid if:

  1. Every opening bracket has a corresponding closing bracket of the same type.
  2. Brackets close in the correct order.

Assume the allowed bracket types are: (), [], {}.

Function signature (example):

  • bool is_valid_parentheses(s: str)

Input:

  • s : a string consisting only of characters in ()[]{} (may be empty)

Output:

  • true if s is valid, otherwise false

Examples:

  • "()" -> true
  • "([]){}" -> true
  • "(]" -> false
  • "([)]" -> false
  • "" -> true

Documentation requirement

For each function, include a docstring with:

  • Description
  • Inputs/Outputs
  • Callouts (assumptions, edge cases, complexity)

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Boston•More Data Scientist•Boston Data Scientist•Boston Coding & Algorithms•Data Scientist Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.