The Lazy Squares
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L4
Problem
You're building a fixture of perfect squares whose decimal form contains a particular digit, and because those squares are scattered you can't tell in advance how far you'll have to look. Given a digit `digit` (0 through 9) and a positive integer `count`, return the first `count` such squares in increasing order, so `squares_with_digit(2, 3)` gives `[25, 121, 225]`.
Summary
A sequence that never fully reveals itself.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.