PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates string-processing and numeric representation competencies, focusing on character-frequency reasoning for palindrome permutation detection and implementation of arbitrary-precision addition for decimal strings.

  • Medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Check Palindrome and Add Decimal Strings

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

##### Question LeetCode 266. Palindrome Permutation – Given a string, determine whether any permutation can form a palindrome. Follow-up: If a palindrome permutation exists, generate and return one such palindrome. Implement addition of two non-negative decimal numbers represented as strings (the numbers may contain a decimal point) without using built-in arbitrary-precision types. https://leetcode.com/problems/palindrome-permutation/description/

Quick Answer: This question evaluates string-processing and numeric representation competencies, focusing on character-frequency reasoning for palindrome permutation detection and implementation of arbitrary-precision addition for decimal strings.

Given a string s of lowercase English letters and two non-negative decimal numbers a and b as strings (each may contain at most one decimal point), perform two tasks: (1) Determine if any permutation of s can form a palindrome. If yes, return the lexicographically smallest palindrome permutation; otherwise return an empty string. (2) Return the sum of a and b as a canonical decimal string computed without using built-in arbitrary-precision numeric types. Canonical means: no leading zeros in the integer part (except "0"), no trailing zeros in the fractional part, and omit the decimal point if the fractional part is empty. Return a dictionary with keys: palindrome_possible (bool), palindrome (string), and sum (string).

Constraints

  • 1 <= len(s) <= 200000
  • s consists only of lowercase English letters 'a' to 'z'
  • 1 <= len(a), len(b) <= 100000
  • a and b match regex: ^\d+(\.\d+)?$ (no sign, no thousand separators)
  • Numbers are non-negative
  • Do not use built-in big integers/decimals for addition; implement digit-by-digit string addition
  • Return the lexicographically smallest palindrome if possible; otherwise return empty string

Hints

  1. A string can be permuted into a palindrome iff at most one character has an odd frequency.
  2. To get the lexicographically smallest palindrome, build the first half by placing characters in ascending order, use the single odd-count character as the center (if any), and mirror the first half.
  3. For decimal addition, split into integer and fractional parts, pad fractional parts to equal length, add from right to left with carry.
  4. Normalize the result: strip leading zeros in the integer part (leave at least one zero), strip trailing zeros in the fractional part, and drop the decimal point if the fractional part becomes empty.
Last updated: Mar 29, 2026

Loading coding console...

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
  • AI Coding 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.

Related Coding Questions

  • Find Shortest Unique Prefixes - Meta (medium)
  • Compute Exclusive Execution Times - Meta (medium)
  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve Tree Diameter and Palindromic Counts - Meta (medium)
  • Simulate Monster Team Battles - Meta (hard)