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.
drodger, Thx.
PavlovNikita,
This is only a 'clever' way to solve it and not either the only way to solve it or the most readable way to solve it. I personally prefer longer code when it is more easily readable. However, sometimes, it is efficient to do it in a single-line/shorter-code.
After joining codewars, I have tried to be terse with code to learn terseness. So, now, I try to balance both as ultimately code needs to be read and re-read and maintained.
Thx
Found that it "passed all tests" when I clicked on "Attempt".
Nice Kata.
Spent hours trying to figure out a faster solution to locating the n-th number in the sequence and finally...
As @ziereis wrote, you will use brute-force but in the right way. If done so, the code will churn out more than 150 numbers in less than 1 second.
I am actually rofl reflecting upon the path I was struggling with for all those hours.
I am using the law of sines to find out the angle between R and F2.
For all testcases, I get the 'R' (Resultant Force) correct. However, for a few testcases, the angle betwen R and F1 is incorrect. Some of the errors are listed below(Order of data given is F1, F2, θ, R, φ):
Sincerely appreciate any insight into what I could be doing wrong.
This comment is hidden because it contains spoiler information about the solution
Nice Kata. KH!, Thanks for making me ROFL and teaching me not to be serious while coding.
Thanks with deep gratitude to all the Kata creators. I have been able to complete all the Katas in 8 kyu without unlocking the solution for any of the Katas.
Superb Kata. It was difficult and painful but in the end I will say that it was enjoyable. After submitting my solution, I found that there are much more efficient solutions. Though my solution worked it was verbose. So, I learnt a LOT!.
Thanks to the Kata-Creator, ExaStencil and everyone else whose comments preceded mine.
Nice- I like this kata. All the information was/is provided in the description. It is a matter of reading the description carefully- a necessary trait for a programmer to model the problem in code.
This isn't as much a coding problem than a Google-ing and understanding the formula for obtaining the total pressure exerted by the gas molecules (homogenous and/or otherwise).
So, to prevent/reduce frustration (no point spending time Google-ing):
molar_mass1 & molar_mass2 - molecular mass in grams of gas 1 and gas 2 respectively.
given_mass1 & given_mass2 - mass in grams of gas 1 and gas 2 at given temperature respectively.
So, pressure, P = ((M1 + M2) * R * T) / V
where M1 & M2 are the number of molecules of gas 1 and gas 2 for the given masses.
I hope my comments for each variable/factor in (2) above are accurate if not correct.
Did not mark this as 'spoiler content' because I am not sure if I am giving away anything that I shouldn't.
Instructions are confusing. Was this done on purpose? Finally...the solution is simple. Cannot give any hints/suggestions without spoiling it for the coder.
Gotcha!
I misunderstood the last rule. Thanks a lot.
The following testcases are incorrect:
Ranomized Tests:
[1] is invalid : True should equal False
[4, 5, 6] is invalid : True should equal False
[2, 4] is invalid : True should equal False
[1, 3, 5, 6] is invalid : True should equal False
[1, 3] is invalid : True should equal False
[3, 5, 6] is invalid : True should equal False
[2, 5, 6] is invalid : True should equal False
[3] is invalid : True should equal False
[2, 3, 5, 6] is invalid : True should equal False
[2, 4, 5, 6] is invalid : True should equal False
[1, 4] is invalid : True should equal False
[1, 5, 6] is invalid : True should equal False
[2, 3] is invalid : True should equal False
[4] is invalid : True should equal False
[2] is invalid : True should equal False
[5, 6] is invalid : True should equal False
[1, 4, 5, 6] is invalid : True should equal False
How come the single digit testcases ([1], [4], [2]) failed when the below passed?
[8] is valid
Also, the rules state that 5 and 6 should be together or shouldn't be there at all. So, why should [5,6] return False?
Thanks for listening.