cswork / libraryOpen practice workspace

Interview questions · Intuit

Solve word segmentation and React palindrome validation

This question evaluates competencies in string algorithms (word segmentation and palindrome validation), data structures and complexity analysis, and practical frontend React implementation with performance considerations.

Part A — String segmentation: Given a non-empty string s and a dictionary of valid words, design an algorithm to determine whether s can be segmented into a sequence of one or more dictionary words. If it is possible, return one valid segmentation; then discuss how you would extend the solution to enumerate all valid segmentations. Analyze time and space complexity, compare dynamic programming with BFS approaches, and describe any optimizations (e.g., using a trie or pruning). Part B — React palindrome validation: Implement a React component that validates whether a user’s text input is a palindrome, ignoring case and non-alphanumeric characters. Requirements: provide real-time feedback as the user types, avoid unnecessary re-renders, handle very long inputs efficiently (e.g., debouncing and a two-pointer check), and include brief unit tests for the normalization and validation logic.

Community answers

Nothing here yet.

Join in on CSWork →