From 91491fa92ae64f36e8277849d0943d20b82093bc Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Thu, 20 Feb 2025 09:40:31 -0700 Subject: 2431. digit queries --- introductory_problems/readme.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'introductory_problems/readme.md') diff --git a/introductory_problems/readme.md b/introductory_problems/readme.md index 3adac29..0046f00 100644 --- a/introductory_problems/readme.md +++ b/introductory_problems/readme.md @@ -90,3 +90,10 @@ A gray code is a list of `2^n` bit strings of length `n`, where any two successi **Input**: The only input line has an integer `n`. (Example: 2) **Output**: Print `2^n` lines that describes the gray code. You can print any valid solution. (Example: 00 01 11 10) + +### Digit Queries +Consider an infinite string that consists of all positive integers in increasing order: 12345678910111213141516171819202122232425... Your task is to process `q` queries of the form: what is the digit at position `k` in the string? + +**Input**: The first input line has an integer `q`: the number of queries. After this, there are `q` lines that describe the queries. Each line has an integer `k`: a 1-indexed position in the string. (Example: 3 7 19 12) + +**Output**: For each query, print the corresponding digit. (Example: 7 4 1) -- cgit v1.2.3