7 kyu
Simple Fun #38: House Of Cats
341 of 723myjinxin2015
Description:
Task
There are some people and cats in a house. You are given the number of legs they have all together. Your task is to return an array containing every possible number of people that could be in the house sorted in ascending order. It's guaranteed that each person has 2 legs and each cat has 4 legs.
Example
For legs = 6
, the output should be [1, 3]
.
There could be either 1 cat and 1 person
(4 + 2 = 6) or 3 people
(2 * 3 = 6).
For legs = 2
, the output should be [1]
.
There can be only 1 person
.
Input/Output
[input]
integerlegs
The total number of legs in the house.
Constraints:
2 ≤ legs ≤ 100.
[output]
an integer arrayEvery possible number of people that can be in the house.
Puzzles
Similar Kata:
Stats:
Created | Jan 25, 2017 |
Published | Jan 25, 2017 |
Warriors Trained | 1336 |
Total Skips | 8 |
Total Code Submissions | 1782 |
Total Times Completed | 723 |
JavaScript Completions | 263 |
C# Completions | 93 |
Python Completions | 341 |
Ruby Completions | 51 |
Haskell Completions | 32 |
Total Stars | 12 |
% of votes with a positive feedback rating | 92% of 189 |
Total "Very Satisfied" Votes | 160 |
Total "Somewhat Satisfied" Votes | 27 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 6 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 7 kyu |