6 kyu
Sum of Two Integers
1,463 of 5,952MrZizoScream
Loading description...
Restricted
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.
Python translation
This felt much harder than it should've, since I had a dumb knowledge gap in not knowing what bitwise operation is, and spent way too much time trying to look for some sort of clever trick lol
Thank you for this challenging but enjoyable kata!
PHP. I have 'Source code contains invalid string interpolation' error. But can't see any in my code... Is't possible to get detail on error?
DO NOT SMILE IN COMMENTS :)
My problem was comment with smile in code.
I'm wondering if this kata should be adjusted.. At least the ruby version, I'm browsing the solutions and not a single one is actually solving the kata, they are all just variations of gaming the system to allow the native '+' function to work.
I got something working for adding positive numbers, but negatives are much harder. Especially when there's no way to add the "-" to the final result without triggering the "no +/-" rule...
This comment has been hidden.
This comment has been hidden.
No. Check out my solution
The kata allows one to simply write return x \u002b b; So one can simply replace + with its unicode Value I am not sure whether this is intended or not
I write in c ++, the code in Visual Studio works fine, but here it gives an error: "runtime error: execution reached the end of a value-returning function without returning a value". Is it a bug in my code, or is there some flaw in this task??
This comment has been hidden.
This comment has been hidden.
+
&-
are prohibitedPretty easy!
This comment has been hidden.
Please, read this: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution State the language, the error, post your code (with markdown formatting and mark your post as having spoiler content). There is no way to help you otherwise.
it's working but 12 seconds aaaaaaaaaaaaaaa!
Op solved it ,closing
This comment has been hidden.
@OmegaAI
No , not all Libraries are not allowed But only the mentioned in the description per each language , Hence you can make use of some obscure language features provided from headers :wink:
Wish you all the Best On/Off CW .. Regards .. Zizou
Getting this error (FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory) but passing all tests.
This comment has been hidden.
Not a kata issue. You're trying to create arrays that are too big, try solving it another way.
This comment has been hidden.
Thanks! You gave me quite a hint to solve the kata ;)
Not really... https://www.codewars.com/kata/reviews/5fb6d3276d9e8e000110482f/groups/5fb7b2bafc3d1200018c1c24
Niether
-
is prohibited. https://www.codewars.com/kata/reviews/5fb6d3276d9e8e000110482f/groups/5fb7b99b6d9e8e00018b68a2Damn, I didn't think this was valid clojure
( - 10 1)
The problem here is a lot of clojure functions have a
-
in the name so we can't ban - outright like we can with +, and also negative numbers...We could ban
-
(dash space) as this is not valid Clojure:( -5 6)
the function call will be seen as-5
So I've republished the kata to ban
+
and-
(dash space)Not really:
https://www.codewars.com/kata/reviews/5fb6d3276d9e8e000110482f/groups/5fb7d024e130810001eb962c
(Just check the solution tab of Clojure)
This comment has been hidden.
Read this: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution
Print the input, there is a problem with big numbers, as the warning at the end tells you.
clojure translation for review
https://www.codewars.com/kumite/5fb5c0e72801d3001c8dcd32?sel=5fb5c0e72801d3001c8dcd32
In rust, I am getting "solution contains a '-'." failure.
Is the checker picking up the '-' in
fn tadd(x: u32, y: u32) -> u32 {
as a minus sign?
@wfdoran
@MrZizoScream: how is it that you're 5kyu now? O_o
That did fix it, but code now pretty ugly due rust's strict type checks. Thanks.
This comment has been hidden.
Try running it with x = -1740173806, y = 1048100893 and you'll see why.
This comment has been hidden.
Rust translation
'alr approved some time ago'
It was updated shortly after to account for an error on my part. I have forked the previous translation here..
In julia many random tests are wrong. For example: add(-5284214779925522942, -5478334000412401012) --> 7684195293371627662. And the same for many others.
This comment has been hidden.
C
is giving me error:But my solution code has no
+
nor any-
If your solution is using a function from the standard library, then there's probably where the nefarious character is being introduced. Remember that the directive
#include
is just pasting the code from the some_library file.
This comment has been hidden.
This comment has been hidden.
They're certainly wrong, and adding a couple of fixed tests would render them invalid, so, I'd say it's worth it adding them.
I just added two zero checks to the js fixed tests
I am getting: "Source code contains invalid string interpolation"
But I am not using any prohibited function or code construction. :(
I think you should use token_get_all to look for invalid code constructions instead of strstr :P
@rubs33
Well, Thanks Rubens for posting, I'm not a Php Coder But I'll review on some important Points, Some Functions in Php are prohibited, especially string interpolation i.e. ("func")() or $obj->{"func"}() , This was mentioned in the notes section :point_up:
I'll keep the issue open till mentioning Php translator to take an action...
What's your code? (Please post with a spoiler flag) I saw a solution through "View Solution", but it's completely valid.
I posted another solution (now it is passing), but my previous solution was not using any prohibited function, nor string interpolation, and it was not passing. ¯\_(ツ)_/¯
@rubs33 Post your code here marking your post as having spoiler content so we can check what's wrong or this issue will be closed because it's not actionable. I've tried my javascript solution in PHP and it gave me the same error, with no string interpolation, the regular expression is matching this:
, (
which is clearly wrong.Increment and decrement operations are not forbidden, right? Because I get the error saying that I used addition and subtraction probably because of the ++/--
Nasm: 'Solution contains "add". Tsk-tsk.' even though neither 'add' nor any prohibited instruction was used.
You must have the character sequence
add
in your code somewhere. The prohibited instruction check is simply astrstr()
call.Please review and approve my Forth translation
@nomennescio
and Thanks for this Description Update :wink:
This comment has been hidden.
This comment has been hidden.
@VicziTomi
Yeah, it was great! Had to do some research, though. I assume that noone would try to solve an add operation without "+" in real life.
This comment has been hidden.
Julia translation
Yep , Revised And APPROVED :+1:
I have an error (FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory), when coding in JS. ANy suggestions what should i do to make it pass?
P.S. All test's cases pass but with this error.
Wrote on c#, and now I first tried c ++. The difference is small, but it was interesting.
@vladerdev
This comment has been hidden.
This comment has been hidden.
Ha, I came up with an even sillier solution.
Hi, can anyone tell me how to contribute to the kata, e.g.: correct translations or misspellings?
@fatherJS .. Well
This comment has been hidden.
@dances-with-peons ..
@dances-with-peons ..
why when checking lambda expression -> is taken as "-"?
@SashaVosu ..
This comment has been hidden.
@___i .. Duplicated Issue :wink: , Is that really bad m oh no I'm crying in the bathroom :cry: :cry: , Oh , thanks for not satisfied :+1: .. But , Yeah , What a nice accomplishment cracking 1Kyu in less than mnoth :sunglasses: :sunglasses:
@MrZiroScream :
... Comment removed since it doesn't matter anyway !
(Hopefully the author takes notice)
..
This comment has been hidden.
@Firefly2002 ..
This is at least the second approved duplicate kata by MrZizoScream...
What numbers generate random test? I got java.lang.OutOfMemoryError: Java heap space
int
@Anastat@ .. Revised and Fixed :+1: .. hope you enjoy Solving the kata Now :wink: .. Regards .. Zizou
If you're looking for a python version, click here: https://www.codewars.com/kata/simple-sum-with-restrictions/
So as I said... two more thing to forbid in Java... ;)
This comment has been hidden.
@Blind4Basics ... Revised and Fixed :wink: .. Added to description Bro :+1: .. Regards .. Zizou
Java: seems like some other things should be forbidden, for now...
@Blind4Basics .. i've mentioned the Java translator to revise carefully and do the necessary .. and I'll keep the issue unresolved till modifications occur :relaxed: .. regards
This comment has been hidden.
Damn me... Wrong check box... x) Reopening above...
@Blind4Basics .. No Problem .. You're Welcome any time :relaxed: .. regards .. Zizou
All banned things by language aren't listed anywhere, like
require
andeval
in JS, how should one know they're banned?Description update published.
I don't see any updates.
Waiting on author's approval.
I hope that clarifies that the
+
and-
characters are banned. There is a difference between the ( binary )+
and the ( unary )++
operator .. ( and then there's the unary-
operator, which is not the same as the binary one )@clcraig ... Many many thanks Bro :+1: :wink: .. Approved :+1: .. Regards .. Zizou
So who approved this duplicate? No unresolved issues about this does not mean one can just approve a duplicate like nothing.
Apparently, Zizo resolved both "this is duplicate" issues a couple months ago and Giacomo approved it -_-
This comment has been hidden.
This comment has been hidden.
The random tests can generate a pair of numbers with their sum outside of int range.
Revised and Fixed...
No, it's not.
check it now ... i think it Fixed ... sorry for the previous one ..
The random tests always generate negative numbers.
Revised and Fixed...
Your reference solution for the random tests are too slow. Even though my code works fine, it still won't pass because of it.
image
(However, I copy-pasted it to the other pre-existing kata and got points, so at least my time wasn't fully wasted)
Fixed..
Typo in "Nagtivee": should be negative.
Well .. hope if I've Forget a Full Stop in the Description will Not Raised an issue .
There are Some Reasons To Raise an issue :
1-
Sample test Cases
Is Lacking one or more that Mentioned in the Test CAses Originally .2-
Test CAses
Don't Run Properly Due To Some Killing Errors .3-
Description
Is Not Clear Enough .. Ambiguous .4-
Rnadom test Cases
Don't Run Effectivley .As Overall Generalization , something Related to the
validity
of the kata .So It's The First Time Ever
Issue Raised
concerningTYpo
, I Think It Will affect Neither The Trainee Understandability To The Kata , Nor The Performance of THe Code ..I Think
Suggestion
is the right Lable For This Little Mistake ,Thanks For informing me That
Typo
has been Considered Recently asIssue
The only right reason to raise an issue: When there is an issue within the kata. This includes typos, poor formatting, weak tests, missing sample tests, missing random tests, broken tests and kata ideas that simply don't work or are a composition of ideas that have already been done before. I'm not going to "suggest" you fix "Nagtivee", it should be Negative on the first place. I have no interest in defending my choice of raising an issue over a suggestion, but do know that I would much rather prefer to have to raise neither. Unfortunately this was simply not the case.
Also, not fixed, typo is still there in both sample tests and validator tests.
I do agree With Part of your Words , (i.e) Random Test Cases Or , missing sample test , .. of course ..
BUT when it comes To
Typo
** The Main Issue Raised here **1- The Reader Can Realize THe Overall Meaning of the word semantically , Those Microscopic ones , will not Lead To Wrong Understanding As long as it's not a number ,
Like if We Say
Explaination
, The One's mind Simply Jumps to The Right meaningExplanation
and This considered atypo
, Analogy in Our case Here , ** The First Test Case ** check Positive , The Last Checks Mixture , Semantically the Middle was Written as ** Nagtive ** So inferring It's a ** Negative ** Instead ,If I Write Something Like This (12
13
14) , you Read it as (Thirteen) , BUTWhen Written (A
13
C) , Your mind Simply Close it to Become (The Letter B) .Issues Not variables , Some power Users Like
Voile
andChrono79
, Have Seen My Previous Katas Include someTypos
Like I've mentionedExplaination
, and did Lable it asSuggestion
.Then they were both wrong.
hahahahahaaaaaaaaaaaaa .. Nice devise , ignoring the Whole Points and evidences , If You want me to Consider your Points knowing (You're higher than me in rank and honor) , Then , Why don't you first Consider
Voile
andChrono79
's (Users Higher Than you) Points in labling it as suggestion ??ah ,, and BTW
thanks For The DownVotes
...Better , Why don't scan The Whole Discourse Searching for Replies Belongs to me and Downvote them ??You're welcome. Since you asked so politely, I did it for you - you owe me a favor.
hahahahaha ... Then that Will make (12 Players) on the Pitch
A typo definitely is not an issue - it's a suggestion. Once I marked a typo an issue, it got resolved because not an issue - and that happens everywhere.
"A typo definitely is not an issue" - What a joke.
Sincere advice, delete your comment since you're putting your life in jeopardy by suggesting that mistakes are room for improvement instead of things to fix. If I were your future employer, this is the kind of things that could send you home.
Duplicate of https://www.codewars.com/kata/additionless-addition.
.
Well ...
Unihedron
As I've Mentioned ... I didn't know There is a kata Similar To Mine ... Didn't scanJavaScrpit
Katas ... BUT When you Notified in the issue There are some points :1- The Kata Sensei
(dukerutledge)
Posted it on May 9, 2014(4 Years ago)
andLast Seen at
(Jul 2015)
, So the Translation ToC++
Will Take Time To Approve .2- Below
Voile
Have Mentioned the Same Issue ... Copying too many elements costs alot .Thanks ..
Unihedron
.. Regards ..Zizou
? I hope you're aware that none of these "reasons" you gave changes the nature that this kata looks like, almost reads like, and solves like the kata I've linked. It uses the same trick and adds nothing new. Not only should it have been a translation, it also needs stricter conditions to block cheaters like this and this.
You marked this issue as resolved, however nothing have been resolved: You did not put a translation proposal for us to merge, nor have you unpublished this duplicate. I'm disappointed in reading a long, tasteless rant on my misuse of the issue ticket system by you, only to immediately see that you're closing a ticket without fixing the problem I stated. It's almost as if- (the rest of this comment is redacted, because I wrote too much and codewars won't let me submit it for being too long, so here's an arbitrary cut off point)
Duplicate:
https://www.codewars.com/kata/additionless-addition
Well ...
Voile
You'veSupported Me Many Times By Instructing to the better to be done ...
. Voile_Votedand always admire Your Solutions
... I didn't know There is a kata Similar To Mine ... Didn't scanJavaScrpit
Katas ... BUT When you Notified in the issue There are some points :1- The Kata Sensei
(dukerutledge)
Posted it on May 9, 2014(4 Years ago)
.2- Last Seen at
(Jul 2015)
, so Icannot translate
his kata to C++ (He Cannot approve it ) .3- The Kata has been
Completed (8) Times with a Satisfaction rate of (100)
4- The Kata has
Ranked (6 Kyu) (My Very First Kata Ever to Rank 6 Kyu)
, Kata Stats ,So I
Beg your generosity
To Approve Mine To be (The First Kata Published in 6 Kyu By Me ) .. Please ...And thanks in advance
Voile
.. Regards ...Zizou
Any power users can approve a translation if the author is long inactive (for at least 1 month). That's one of the changes that was made last year.
Well ... I wished from Yesterday to be my Own Independent Kata Not a Translation .. Thanks
I Think We Can REframe The Famous question-type (True and False) to (True and Voile )