Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

FizzBuzz and String Processing

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is FizzBuzz and String Processing. Start with the requirements on the right.

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.

Problem

For an Epsilon Systems coding utility, implement a function that performs three independent operations: generate FizzBuzz labels, find the first non-repeated alphanumeric character, and reverse the order of words in a text string.

Formal Specification

Implement coding_pipeline(text, n). Return a dictionary with these keys:

  1. fizzbuzz: A list of strings for every integer from 1 through n. Use "Fizz" for multiples of 3, "Buzz" for multiples of 5, "FizzBuzz" for multiples of both, and the decimal number otherwise.
  2. first_unique: The first alphanumeric character that occurs exactly once in text, compared case-insensitively. Return the character in lowercase, or None if no such character exists. Ignore spaces and punctuation.
  3. reversed_words: The words from text in reverse order, joined with one space. Any leading, trailing, or repeated whitespace should be normalized.

Constraints

  • 1 <= n <= 10^4
  • 0 <= len(text) <= 10^5
  • text may contain letters, digits, whitespace, and punctuation
  • FizzBuzz output must contain exactly n elements

Function Signature

def coding_pipeline(text, n):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output