Skip to main content

Questions tagged [data-structures]

For challenges involving ways to organize data (hash maps, arrays, binary trees ...)

1 vote
2 answers
312 views

Input You are given 2 positive integers, n, q, followed by q queries. the queries can be of two forms: 0 a b: add the line a*x + b. a and b are integers between -...
3RR0R404's user avatar
  • 115
11 votes
5 answers
594 views

In this challenge Bubbler describes sorting a list by inserting its elements left to right into a double ended queue or "deque". Take a number from the front of the array, and push it into ...
Wheat Wizard's user avatar
  • 103k
24 votes
16 answers
3k views

You're given an array of positive integers. Your job is to sort them using an initially empty deque (double-ended queue) by the following procedure: Take a number from the front of the array, and ...
Bubbler's user avatar
  • 79.3k
26 votes
22 answers
2k views

Intro The Tetris Guidelines specify what RNG is needed for the piece selection to be called a Tetris game, called the Random Generator. Yes, that's the actual name ("Random Generator"). In ...
bigyihsuan's user avatar
  • 11.4k
8 votes
33 answers
1k views

Challenge: Given the input array l with a list of strings, only keep the elements in the sequence that have a letter that's repeated at least 3 times. Like ...
U13-Forward's user avatar
  • 2,031
14 votes
10 answers
531 views

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. Inspired by https://xkcd.com/835 In the midst of his mid-life crisis, Santa has impulsively purchased a Sports ...
Ginger's user avatar
  • 6,098
13 votes
10 answers
736 views

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. Fen is a magician Elf. He can cast spells on an array of numbers to produce another number or array of numbers. One ...
Bubbler's user avatar
  • 79.3k
20 votes
25 answers
2k views

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. Fen is a magician Elf. He can cast spells on an array of numbers to produce another number or array of numbers. One ...
Bubbler's user avatar
  • 79.3k
12 votes
4 answers
377 views

A binary max heap is a rooted tree with integer labeled nodes such that: No node has more than 2 children. The label of every node is greater than all of its children. We say a sequence of integers ...
cjquines's user avatar
  • 1,391
2 votes
1 answer
1k views

The event scheduler is a recurrent theme in event-driven architectures: something triggers an event that needs to be checked in the future one or more times. I has particular use in trading where you ...
user avatar
43 votes
52 answers
3k views

For this challenge, a linked list looks like this: [1, 2, 4, 0, 6, 1, 3, 1] You'll notice there's no data; each item in the list is just a reference to the index ...
rydwolf's user avatar
  • 19.3k
1 vote
1 answer
186 views

In a fictional document management system, input documents are structured with weighted headings. Lowest weighted headings are the most important. This is a sample document: H1 All About Birds H2 ...
Tlink's user avatar
  • 111
25 votes
3 answers
806 views

Given a possibly nested, non-empty array of single-digit positive integers (not guaranteed unique), output the ASCII-art representation as a tree, using the box-drawing characters ...
AdmBorkBork's user avatar
  • 43.7k
48 votes
85 answers
9k views

I can't believe we don't have this already.. It's one of the most important data-structures in programming, yet still simple enough to implement it in a code-golf: Challenge Your task is to ...
ბიმო's user avatar
17 votes
31 answers
2k views

I use "suffix" loosely here to mean "any sub-string that follows the prefix". "Prefix" here means the START of a word, where a word's start is defined as either after a space or from the first ...
DrQuarius's user avatar
  • 680

15 30 50 per page