Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Questions tagged [counting]

For challenges regarding counting the number of occurrences of some characteristic.

Filter by
Sorted by
Tagged with
3 votes
1 answer
303 views

CHALLENGE This problem has a math background. For n=1,2,3,4 we want to count the number of families of sets with maximum n elements that satisfy many criteria of the form: $$\bigoplus_{k\in A,A\in \...
17 votes
20 answers
2k views

A 1D go position on a board of size n is a sequence of length n consisting of the numbers0, <...
33 votes
21 answers
3k views

Go Fish! Given a school of fish, for example: ...
7 votes
12 answers
815 views

Challenge: Write a program or function that, given positive integers n, t, b, c, counts permutations of 1..n where: Exactly t numbers are in their original position Exactly b numbers are higher than ...
-1 votes
1 answer
189 views

Inspired by this problem. Golomb's self-describing sequence g(n) is a sequence where any natural number n is repeated within the sequence g(n) times. Given an input of \$ n \,ドル output: $$ \left( \sum_{...
16 votes
17 answers
1k views

Given a sequence of integers with length \$L\$ and an integer \1ドル \le N \le L\,ドル an "\$N\$-rich" permutation is one whose the longest strictly increasing contiguous subsequence has length ...
EmilyR's user avatar
  • 1,533
31 votes
50 answers
3k views

Challenge Given a string of any length which contains only digits from 0 to 9, replace each consecutive run of the digit ...
user avatar
28 votes
49 answers
3k views

Write a program or function which takes a string of text as input and outputs the number of non-alphabetical characters in it (standard I/O rules apply). A non-alphabetical character is any character ...
10 votes
1 answer
416 views

Consider a NxN pixel grid with up to M objects drawn on it, either squares or diamonds: square diamond The objects may overlap, so recognition is hard. The task is to give the minimal possible ...
16 votes
14 answers
1k views

Description You have a list of integers and start counting from the first term to the next and continue from that to the next and so on.. How many times have you counted? For example given [ 2, 5, 3, ...
34 votes
30 answers
2k views

Your challenge is to, given a positive integer n, count up to each digit of it, giving the effect of converging on it. Basically, count up to the first digit of n by its place value (\$⌊\log_{10}\left(...
22 votes
36 answers
2k views

Definition Given some string return an integer whose digits are the number ocurrences of a-z (case insensitive, in alphabetical order) in that string. Any character with 0 instances is skipped. ...
Nigel's user avatar
  • 357
19 votes
2 answers
648 views

Content You count numbers every day (I think), and most of you know how to count properly, the one next to 1 is 2, and the next ...
15 votes
12 answers
2k views

This is similar in concept to this challenge, but that is pretty restrictive on input and output and I think opening up these restrictions would lead to a completely different set of solutions that ...
EmilyR's user avatar
  • 1,533
33 votes
55 answers
2k views

Task: Given an array of numbers as input (you can choose what subset, such as integers or natural numbers), replace all items with the number of times they appear within the array. As an example, <...
rydwolf's user avatar
  • 19.3k

15 30 50 per page
1
2 3 4 5
...
9

AltStyle によって変換されたページ (->オリジナル) /