6 kyu
Imaginary Base Conversion
107 of 246feeg1
Loading description...
Mathematics
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
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.
Factor translation
approved
This comment has been hidden.
Why returning
std::vector<int>
in C++, if there is a built-instd::complex<int>
?It's the same in Python.
All three are bad, but not all questions have a good answer ..
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.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!
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:
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!
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
Fixed
Approved
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.Fixed, thanks!
This comment has been hidden.
Thank you, fixed! I'm still learning how all this works so I didn't even realize