Skip to content

Commit a9017e1

Browse files
Merge pull request #156 from coding-cat-official/string-2-problems
A few haystack problems
2 parents dd84ccf + 61baab0 commit a9017e1

File tree

12 files changed

+128
-0
lines changed

12 files changed

+128
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Every year, at Sunnyville Elementary, the teacher hands out birthday cards numbered from 1 to N — one for each student. This year, the cards got mixed up on the way to class. Some cards went missing, and some mysterious extra cards with weird numbers showed up.
2+
3+
Now, the teacher has a pile of cards but can’t tell which students actually got their birthday wishes and which ones got skipped or got the wrong cards. It’s a bit of a mess!
4+
5+
The teacher wonders if you can help figure out which birthday card numbers didn’t make it to the pile — and make sure no strange cards sneak in pretending to belong.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[
2+
{
3+
"input": [[1, 2, 4, 6], 6],
4+
"output": [3, 5]
5+
},
6+
{
7+
"input": [[2, 3, 7], 7],
8+
"output": [1, 4, 5, 6]
9+
},
10+
{
11+
"input": [[1, 2, 3, 4], 4],
12+
"output": []
13+
},
14+
{
15+
"input": [[], 3],
16+
"output": [1, 2, 3]
17+
},
18+
{
19+
"input": [[1, 3, 5, 7, 9], 10],
20+
"output": [2, 4, 6, 8, 10]
21+
}
22+
]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"title": "The Great Birthday Card Mix-Up",
3+
"name": "birthday_card_mixup",
4+
"difficulty": "medium",
5+
"author": "ChatGPT, edited by Emmanuelle",
6+
"category": "haystack",
7+
"question_type": [
8+
"haystack"
9+
]
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def birthday_card_mixup(birthdayCardNumbers: list[int], numberOfStudents: int) -> list[int]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Deep in the forgotten ruins of Linguistica, explorers discovered an ancient scroll filled with strange symbols that seem to shift and shimmer. One moment a symbol looks like a fiery rune, the next it morphs into a watery glyph — and sometimes it even doubles back on itself!
2+
3+
The ancient linguists are baffled: they know the true secret lies hidden in the longest sequence of symbols that never repeat — but with symbols constantly shape-shifting, no one can quite tell which are truly duplicates.
4+
5+
Your puzzling task is to decode the scroll and find that longest stretch of apparently unique symbols — if you can figure out what counts as “unique” before the scroll changes again!
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[
2+
{
3+
"input": ["⚡🔥🌊🔥🌪️"],
4+
"output": "⚡🔥🌊"
5+
},
6+
{
7+
"input": ["𓂀𓂁𓂂𓂀𓂃"],
8+
"output": "𓂀𓂁𓂂"
9+
},
10+
{
11+
"input": ["◇◆◉◈◇◆"],
12+
"output": "◇◆◉◈"
13+
},
14+
{
15+
"input": ["🜁🜂🜃🜄🜁"],
16+
"output": "🜁🜂🜃🜄"
17+
},
18+
{
19+
"input": ["🌟"],
20+
"output": "🌟"
21+
},
22+
{
23+
"input": [""],
24+
"output": ""
25+
},
26+
{
27+
"input": ["🎴🎴🎴🎴"],
28+
"output": "🎴"
29+
},
30+
{
31+
"input": ["✪✩✫✬✭✮✩✯"],
32+
"output": "✪✩✫✬✭✮"
33+
}
34+
]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"title": "The Enigmatic Scroll of Ever-Changing Symbols",
3+
"name": "scroll_of_ever_changing_symbols",
4+
"difficulty": "medium",
5+
"author": "ChatGPT, edited by Emmanuelle",
6+
"category": "haystack",
7+
"question_type": [
8+
"haystack"
9+
]
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def scroll_of_ever_changing_symbols(ultimate_scroll: str) -> str
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
In the whimsical land of Sweetopolis, the Jellybean Council was responsible for naming every single jellybean flavor in the kingdom. However, the council members had a peculiar habit — every time a jellybean was created, they would excitedly shout out its flavor name and write it down in the Grand Jellybean Registry.
2+
3+
But here’s the problem: the council was a bit forgetful and overly enthusiastic. They kept shouting the same flavor names multiple times, leading to dozens of identical entries in the registry. The King of Sweetopolis was baffled. “How can I reward the inventors if the registry is cluttered with repeated flavor names?”
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[
2+
{
3+
"input": [["pickle punch", "sour socks", "pickle punch", "wasabi whirl"]],
4+
"output": ["pickle punch", "sour socks", "wasabi whirl"]
5+
},
6+
{
7+
"input": [["rotten egg", "clam chowder", "rotten egg", "rotten egg", "garlic blast"]],
8+
"output": ["rotten egg", "clam chowder", "garlic blast"]
9+
},
10+
{
11+
"input": [["toothpaste twist", "cough syrup", "moldy cheese"]],
12+
"output": ["toothpaste twist", "cough syrup", "moldy cheese"]
13+
},
14+
{
15+
"input": [[]],
16+
"output": []
17+
},
18+
{
19+
"input": [["vomit swirl", "vomit swirl", "vomit swirl"]],
20+
"output": ["vomit swirl"]
21+
},
22+
{
23+
"input": [["dirty socks", "pickle punch", "sour socks", "pickle punch", "dirty socks"]],
24+
"output": ["dirty socks", "pickle punch", "sour socks"]
25+
}
26+
]

0 commit comments

Comments
 (0)