7 kyu
Sum of Minimums!
1,693 of 28,243Aizaz_Ahmad
Loading description...
Fundamentals
Arrays
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.
GROOVY TRANSLATION
Please review and approve. Note: it's my very first translation, and if I missed something, I would appreciate your suggestions.
Java translation
the input matrix should be
const
-qualified in C:the initial code has been adapted
I dont get where array pointer in NASM.
; <-- RAX sumofmin(ro [qword [dword RDI]] nums, RSI rows, RDX cols) -->
So[rdi]
should be first item in array? I even did some function to print values in STDERR and everything worked fine but for[rdi]
. Code i did and even checked on my machine works and would here too i believe if i could get this array.the input is a matrix:
int **
, i.e. an array of 8-byte pointers to 4-byteint
.[rdi]
gives you the (address of the) first row of the matrix, not the first element of the first rowThanks, worked
Lua translation!
No random tests in Swift
Go Translation!
There's an bug in the initial solution.
What language are you using? What bug have you experienced?
Insufficient info, closing
https://docs.codewars.com/concepts/kata/discourse/#suggestions
For some reason, the random tests in the C# translation almost never fail, and you can return pretty much anything. I was able to submit a solution that has hard-coded return values for the three visible test cases, and just returns 0 for all other tests:
https://www.codewars.com/kata/reviews/5e5904021cff490001cdb237/groups/64ca1a6ca9a9ec0001fc2fb8
Fixed.
All of the random tests failed for me. One of the tests tested for [[49, 136],[128,82],[17,83]]. It failed telling me 'Expected 148 to equal 347'. So 49 + 82 + 17 = 347? Or have I grossly misunderstood something?
Don't mutate the input.
Thanks for the reply but I don't understand. The description says, "your task is to find the sum of the minimum values in each row."
As I understand it, the minimum values of each row in the above test are 49, 82 and 17, of which the sum is 148, not 347. What am I missing?
You're removing those numbers from the input, so, when the control function calculates its sum, it's using the other numbers:
136 + 128 + 83 = 347
Anyways, I've changed the tests so the expected value is computed first and your code messing with the input isn't a problem anymore, but be aware of that.COBOL translation. I took the unified description from Haskell translation (see below), so as far as I understand the merge process, there should be no merge conflict.
There will be a merge conflict.
The merge is based on the description on the moment of forking. If that changes between fork ( cq. creation of translation ) and approval, you're OOL, even if you have the same description as the current one.
If a translation that changes the description is waiting, hold off on starting new translations.
( As I understand it. )
That's definitively a mess. I'm not favorable to hold off new translations, fixing merge conflicts when they happen is fine (it's easily done, anyone can dot it, and we are, unfortunately, used to it).
I fully agree. :/
approved
Haskell translation
This translation unifies the description. Languages that do not comform to these specs should have their testing updated, not the specs.
Approved
i wrote the function in vs code and it worked...but when i tried to submit, it showed that I was wrong i dont know but my code works well in vs-code :(((
check: https://docs.codewars.com/training/troubleshooting#works-but-no
sum or value?
sum
The description is clear enough, except for one thing: Example of the final output. There are examples of min output. It would be better if the final output, which is the sum of all the mins, is written too.
There was a problem hiding the rest of the description, fixed.
The instruction to this Kata is too vague. Can someone please explain what exactly our function is supposed to do? Thanks
You have to find a minimum value in each row and sum that and then return the sum from the function
Check the instruction again, it's been updated.
Why does Rust have 4x4 arrays, while all previous languages have dynamic sizes?
For C
Suggesting to silence or remove the warnings that the new language version brought with it. They do not affect passing of the Kata.
fixed in list of C katas to update
gud cata
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
C# sample tests have reversed initializer values. Once I swapped the '3' and '5' in the first two tests, it worked fine.
C# Translation!
Check your sample tests. I think the initializing values for the first two tests are reversed. Once I swapped them, I was able to pass both the sample test and all the final tests. I could be wrong!
I adjusted that. Also the solution was in the preloaded code with the same namespace as the tests. So the tests were always using the preloaded solution instead of the user solution which has no namespace.
CFML Translation!
This is your first kata that you authored it's nice one best wishes for future kata's.Happy coding...
thanks a lot
Reraising the issue that @FArekkusu originally raised below. Being a duplicate is an issue, and, though lack of novelty is subjective, it's a certainty that the task of adding up
min
values has been (over)done.EDIT: a useful reference -> https://github.com/codingforeveryone/READMEs/blob/master/codewars/writing-your-own-kata.md#golden-rule-1--search-for-duplicate-kata
Not a duplicate! The true target of the issue is just to attack...
One More Hater From Mafia Haters?)
WoW!
Mafia Haters vs. Me
الله أكبر
Earlier issues were not fixed.
Earlier haters still were not punished... :|
This comment has been hidden.
But it has
Python
The description says the numbers will be positive, but the random tests can contain zeros.
Resolved! Thanks
Good stuff, thank you.
This comment has been hidden.
Resolved! Thanks
None of the issues were fixed.
None of the haters were punished... (chuckle)
This is not a 2D array.
👍
I'm still confused about arrays in C and assembly, I had some trouble with this. In C it behaved like a standard 2D array, but in NASM I had to dereference rdi to get a pointer to the array. (I expected rdi to point to the first element in the array). Is this what usually happens?
Duplicate of this and this.
You mean duplicate of a mix between the two.
Thanks
Not really. This has arrays within an array, and the goal is to find the minimum in each array and add them. Neither of those katas have the same objective, or even work with the same dimension of array.
This kata lacks novelty.
Ok, the community will decide
This comment has been hidden.
See that you are one of the
Mafia
if decided to downvote me... But i will stand up and continue to go...بإذن الله
This kata lacks novelty.
Hater! Not an issue!
why call the input "square" if it is
3 x 5
?Changed!
Also edit the number of columns to be the same in the description...
There's nothing new or particularly interesting in finding the minimum values in a collection or summing them.
Yup, it is not interesting for someone like you! who have solved 3900+ Katas.But, it is interesting for beginners like me!
Not for you(who have solved 3900+ Katas) But for most of beginners like me.
Can I mark is an issue resolved?
Not an issue!
Thanks!
Solutions can change the input before the reference solutions is called. The reference solution should be called first or a copy should be passed.
Check Now
A vector is passed to the user.
Should I write, "Given a 2D vector"??
There are no 2D vectors in C++. It's a vector of vectors.
Thanks!
There's an bug in the initial solution.
PLease Tell
Fixed
Tests are in the same unit in C++, so be careful about what's accessible: https://www.codewars.com/kata/reviews/5d5ee4d8ad2c6800010dc1a5/groups/5d5ef2d4d442750001a3a3fc
Should I change the name of reference solution to something other than sol??
You can bind the solution as a lambda to a local variable, for example. Changing its name to a random unpredictable name is an option too as long as it can't be revealed in error messages.
I have Changed! Thanks!