6 kyu
# Counting 1: I Want Some Subsets, Not All!
182 of 307raulbc777
Description:
We have a set of consecutive numbers from 1
to n
.
We want to count all the subsets that do not contain consecutive numbers.
E.g.
If our set S1
is equal to [1,2,3,4,5]
The subsets that fulfill these property are:
[1],[2],[3],[4],[5],[1,3],[1,4],[1,5],[2,4],[2,5],[3,5],[1,3,5]
A total of 12
subsets.
From the set S2
equals to[1,2,3]
, it is obvious that we have only 4
subsets and are:
[1],[2],[3],[1,3]
Make a code that may give the amount of all these subsets for any integer n >= 2
.
Features of the random tests:
number of tests = 100
10 <= n <= 120
Number Theory
Fundamentals
Similar Kata:
Stats:
Created | May 10, 2017 |
Published | May 10, 2017 |
Warriors Trained | 1715 |
Total Skips | 124 |
Total Code Submissions | 1429 |
Total Times Completed | 307 |
Python Completions | 182 |
JavaScript Completions | 78 |
Ruby Completions | 25 |
Haskell Completions | 16 |
C# Completions | 24 |
Java Completions | 28 |
Scala Completions | 7 |
Total Stars | 35 |
% of votes with a positive feedback rating | 89% of 82 |
Total "Very Satisfied" Votes | 67 |
Total "Somewhat Satisfied" Votes | 12 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 5 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |