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.
theres like two main approaches taken to this problem, but some just way overcomplicate the solution.
hint. read about c++ streams
does up and down climbs count equal weight of difference
if starting from 9 -> 8 -> 7 differences would be still = 3 between these?
is it the same as going from 7->8->7 differences would still be 3?
pro (or noob) tips for C++
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
very clean version using the generic programming! would not have thought this up myself very easily.
what must I do for C++ version of this kata, there is barely any test cases and some comment tells me to create helper object but my code keeps crashing because of that?! I already passed this kata with plain C, but I wanted to see if C++ could be done also...
very nice kata but it was quite simple to "problem-solve" (usually for 6kyu and harder -> they are devilish for problemsolving)
It has been a long time (no pun intended) since I coded Java.
I just used if-else statements and basic math, and maybe two loops to get the time from the input string xD ...
Then I saw that other people used "snappy code" with all kinds of cool Java functions I was awestruck once again
O_o
this was the most confusing kata ever... I still dont know what I was supposed to do even though apparently I succeeded xD
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Definitely a tough challenge from the computational/algorithmic point of view... I'm not sure if my way of doing it is the most efficient because my solution relies on rational number calculations (with c++ vector) and factoring the initial number...
if any of you decide to implement factoring -> make sure your trialDivisionFactoring is not the naive solution! :D
I finished the problem by improving the efficiency of factoring function that I had !
Code passes basic tests but takes too long to execute apparently...
I was doing this in C++ and was under the impression that you have to treat the summed reciprocals as rational numbers (in my code vector with num and denom as [0] and [1])
Then you would presumably have to expand those rationals to the same base, and add the numerators, and get then the biggest factor, would be the "expandedDenominator"
Then you just invert and multiply, and that result itself has to be reduced to irreducable form.
But my code is apparently too slow even still... but
´´´CPP
#include
#include
#include
#include
#include
using namespace std;
unsigned long long recurGCD(unsigned long long a, unsigned long long b) {
if (b == 0) {
return a;
}
else {
return recurGCD(b, a%b);
}
}
bool isOre(unsigned int n) {
vector factorslist;
unsigned long long expandedDenominator = 1;
int factorscount = 0;
unsigned long long biggest = 1;
unsigned long long sumExpandedNominator = 0;
}
´´´
Loading more items...