It was like SUPER late when I attempted the problem and I was not at my best. I know all about base-types and numerical expressions.
I was just being stupid. I got some help via discord and ended up getting to a solution that, while clunky, helped to teach me some fundamentals.
I put an EXTENSIVE comment suite in the solution that explains my data stream for a sample input. Thanks!
Do you know what are number systems with different bases? Like binary, octal, decimal, hexadecimal?
Do you know what are imaginary numbers, complex numbers, and imaginary unit i?
There are two ways to solve this kind of problems:
research relevant topics, like the two I mentioned above, or
leave the kata for now, and forget it, or come back to it after getting better grasp of maths behind it.
I am pretty new to coding and do not really know what to do with a problem that is basically pure maths like this. What does that last block mean [a, b] = a+b*i? What is my output actually supposed to look like? If I am given a string with some number like 101 (one hundred one) and...is that not ALREADY in base 10 form? I am very confused. Could I have some clarification? Thanks!
Description, second code block: why are you going on into negative exponents? This would be applicable to some fixed point situation, but not here, is it? It's inconsistent with all other examples and tests.
Third code block: -1 + 0 + 1 does not equal 2. The example test has this correct though.
Great kata! Very original. Enjoyed solving it. Only 189 completions in 7 years? Come on codewarriors, give it a go. This one deserves more attention.
All three are bad, but not all questions have a good answer ..
approved
Factor translation
This comment is hidden because it contains spoiler information about the solution
Why returning
std::vector<int>
in C++, if there is a built-instd::complex<int>
?Sample tests and initial solution are broken.
using namespace std;
in it. That shouldn't be a case.using namespace std;
being in the solution. That shouldn't be a case either.It was like SUPER late when I attempted the problem and I was not at my best. I know all about base-types and numerical expressions.
I was just being stupid. I got some help via discord and ended up getting to a solution that, while clunky, helped to teach me some fundamentals.
I put an EXTENSIVE comment suite in the solution that explains my data stream for a sample input. Thanks!
Do you know what are number systems with different bases? Like binary, octal, decimal, hexadecimal?
Do you know what are imaginary numbers, complex numbers, and imaginary unit
i
?There are two ways to solve this kind of problems:
I am pretty new to coding and do not really know what to do with a problem that is basically pure maths like this. What does that last block mean [a, b] = a+b*i? What is my output actually supposed to look like? If I am given a string with some number like 101 (one hundred one) and...is that not ALREADY in base 10 form? I am very confused. Could I have some clarification? Thanks!
Fixed
10010 in base i would be:
1*i^4 + 0 * i^3 + 0 * i^2 + 1 * i^1 + 0 * i^0 = 1 + -i = 1-i
This should be
1 + i
,1 * i^1 = i
not-i
Approved
Fixed, thanks!
Description, second code block: why are you going on into negative exponents? This would be applicable to some fixed point situation, but not here, is it? It's inconsistent with all other examples and tests.
Third code block:
-1 + 0 + 1
does not equal2
. The example test has this correct though.Loading more items...