- Difficulty: Hard
- Calculate the minimum required number of swaps of neighbouring letters in a string built from the letters 'a' and 'b', after which the string would contain both "aaa" and "bbb" as substrings.
- https://app.codility.com/programmers/challenges/codealone_2021/
- https://app.codility.com/programmers/task/a_b_swaps/
- Result
Good
: Correctness 100%, Performance 100%.OK
: Correctness 100%, Performance <100%.Fail
: Correctness <100%, Performance <100%.
- File naming convention
- Code
A
:CodeAlone2021A.java
- etc
- Code
File | Description | Complexity | Result | Report |
---|---|---|---|---|
C1 |
Analysis Table | O(N) |
Good |
U5TV62 |
File | Description | Complexity | Result | Report |
---|---|---|---|---|
A1 |
Array | O(N) or O(N**4) |
OK |
NR8E2J |
A2 |
Array | O(N) or O(N**4) |
OK |
DMVG4N |
B1 |
Tree | O(N) or O(N**4) |
OK |
5F6H9D |
B2 |
Tree | O(N) or O(N**4) |
OK |
DJSTY5 |
B4 |
Tree | O(N) or O(N**4) |
OK |
JR3QRR |
B5 |
Tree/Array | O(N) or O(N**4) |
OK |
K4VHV8 |
B6 |
Tree/Array | O(N) or O(N**4) |
OK |
9XCUNY |
B3
was incomplete and has been deleted.B4
has a bug, failed this scenario:(abaab)*
, expected 3 but was 2.
File | Complexity | Result | Report |
---|---|---|---|
D1 |
O(N) |
Good |
4X3A4K-2SA |