The Hackers’ Taunt
Description:
Decrypt the System – The Hackers’ Taunt
Description:
Your website has been hacked! A group of witty and arrogant cybercriminals infiltrated your server, stole all vital credentials, and encrypted your system. To make matters worse, they’ve covered their tracks so well that no immediate recovery is possible.
But instead of demanding a ransom, these hackers are taunting you. They’ve left a cryptic challenge—solve it, and you'll get the decryption password!
The Challenge:
The hackers have hidden the password deep inside a nested structure. Your task is to extract and join in the reversed order all strings that are located at a specific depth level in the nested structure.
Input:
- A list of lists, which may contain either:
- Other sub-lists (representing deeper levels).
- Strings, which are the values stored in the structure.
- An integer depth level (N) that indicates which level you need to extract strings from.
Output:
- A single string, formed by joining all strings found at depth N, in the reversed order of appearing.
- If there are no strings at the given depth ( Oops, hackers lied :[ ), return an empty string ("").
Notes:
- Only strings at depth N should be considered. Ignore strings at any other depth.
- Nested lists can go arbitrarily deep.
- Strings must be concatenated in the reversed order they appear at the correct depth.
Understanding Depth:
The depth is zero-based, meaning:
Depth 0:
- Strings that are directly in the main list are at depth 0.
Depth 1:
- Strings that are inside a sublist of the main list are at depth 1.
Depth 2 and beyond:
- Strings that are in a sublist of a sublist are at depth 2, and so on.
Examples:
[ ["hello", [ [], [], "hiya", ["hiii", [[["lol"]]] ] ],"hi", [ [["he", "world"] ], [ ["hi", "!" ] ] ] ] , [ ["hi", "!","lol!",["lol"] ] ]], 3
-> "lol!!hihiya"
[ [ ["b"] , ["a"] ], ["world", "hello"]], 1
-> "helloworld"
[["a"], ["b]", ["c"], ["world", "hello"]], 2
-> ""
[ ["a", [[[["here"]]]] , ["hello"] ], ["b",[ [], [[]],[] ], "c",[]], ["world", "hello",[[[[[[]]]]]] ], ["?",[[[["also", "here"]],["not here"]]]],"not"], 5
-> "herealsohere"
["a", "b", ["c"], ["world", "hello"]], 0
-> "ba"
Let's go!!!
Please, be sure to check out my other katas:
Similar Kata:
Stats:
Created | Feb 7, 2025 |
Published | Mar 2, 2025 |
Warriors Trained | 146 |
Total Skips | 8 |
Total Code Submissions | 151 |
Total Times Completed | 75 |
Python Completions | 75 |
Total Stars | 3 |
% of votes with a positive feedback rating | 90% of 25 |
Total "Very Satisfied" Votes | 20 |
Total "Somewhat Satisfied" Votes | 5 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 9 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |