Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
codeseries
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
La Fée Verte
codeseries
Commits
8a06e1a2
Commit
8a06e1a2
authored
10 years ago
by
La Fée Verte
Browse files
Options
Downloads
Patches
Plain Diff
Update README.md
parent
32d627eb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+32
-0
32 additions, 0 deletions
README.md
with
32 additions
and
0 deletions
README.md
+
32
−
0
View file @
8a06e1a2
codeseries
codeseries
==========
==========
Lock Combination Generator
A lock combination manufacturer needs to maintain a database of all
possible combinations for their locks. You are tasked with writing a
program that generates all possible legal combinations within the rules
set by the manufacturer.
Rules
-
Values for a position: A,B,C,D,E
-
Number of positions: 6
-
Adjacent positions cannot differ by more than 2 (AC and BD are
valid adjacent positions; AD is not)
-
No more than 3 contiguous positions can have the same value (AAA is
OK, AAAA is not)
-
No more than 4 of the same value can be in a combination (AABBAA is
OK, AAABAA is not)
The manufacturer wants to allow for future expansion, so the number and
values of positions must be configurable. (So, your program should be
able to handle values up to A-Z, and it should be able to handle 8
positions, or 10, or even more.) The manufacturer will assign a lookup
code (starting with 1 and incrementing) to each combination. However,
the collection of combinations needs to be randomly shuffled before
assigning the lookup codes to them. The output should look something
like this:
1: ABABAC
2: CDCDCA
3: ABCDEA
...
When writing your code, be sure to utilize proper object-oriented
techniques and design. Show appropriate use of class construction.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment