Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
it's currently C# 10.0 from .NET 6.0, and I can use destructuring assignment just fine. Closing, as the C# version got updated
Kata is now retired.
You are the best!
This comment is hidden because it contains spoiler information about the solution
My first implementation passed all tests, eventhough it evaluated
"1 + 2 * 3 * 4" to 28 (the correct answer is 25)
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
my bad, error was in my code
please remove/resolve this issue
Having a closer look at both the Random tests that pass and fail, I have a suspicion this is caused by the '/' symbol - which is shared by all three modes
I have failing tests when I attempt this in C# (in the Random and SymbolsEdge sets), which I can't explain.
For example, my solution fails on the following inputs:
"2>2 ZmU4sm7v.#56& e#M@ ¿ /+T," (Random test says: Expected value 216, my solution gives 214)
"Gk0_ @HN?/" (Random test says: Expected value 62, my solution gives 61)
I've tried the latter one manually, also arriving at 61. Here's the output:
from: (0, 0)
to: G (1, 1), mode: 2
takes: 1 shifts, totalling 6 presses
total: 6
from: (1, 1)
to: k (2, 0), mode: 1
takes: 2 shifts, totalling 9 presses
total: 15
from: (2, 0)
to: 0 (3, 7), mode: 1
takes: 0 shifts, totalling 3 presses
total: 18
from: (3, 7)
to: _ (4, 6), mode: 1
takes: 0 shifts, totalling 3 presses
total: 21
from: (4, 6)
to: (5, 1), mode: 1
takes: 0 shifts, totalling 5 presses
total: 26
from: (5, 1)
to: @ (3, 6), mode: 1
takes: 0 shifts, totalling 6 presses
total: 32
from: (3, 6)
to: H (1, 2), mode: 2
takes: 1 shifts, totalling 10 presses
total: 42
from: (1, 2)
to: N (2, 3), mode: 2
takes: 0 shifts, totalling 3 presses
total: 45
from: (2, 3)
to: ? (0, 2), mode: 3
takes: 1 shifts, totalling 11 presses
total: 56
from: (0, 2)
to: / (4, 8), mode: 3
takes: 0 shifts, totalling 5 presses
total: 61
I don't look ahead in the string to optimize for shift.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
There's more to a Best Practice than asymptotic performance, e.g. readability and expressiveness.
Out of curiosity, what do you think the asymptotic performance of this solution is?
Loading more items...