"If you lie to the computer, it will get you."
Favorite Granny's Wisdom Pearl
"If you lie to the computer, it will get you."
Favorite Granny's Wisdom Pearl
"If you lie to the computer, it will get you."
Favorite Granny's Wisdom Pearl
I presume by “colon” you mean “column”.Deja Quavern wrote:Oups, I forgot:
Do
resets the count when we are done with a colon?
Junilu Lacar wrote:The secret test is probably one that senses performance issues. I suspect your algorithm is taking too long to execute, given you have basically four nested loops.
In some cases, we provide extra information apart from the judgement itself, to help you debug your code. This information is available on the page for the respective submission (available by clicking on the corresponding submission ID in your list of submissions)
Every good tree bears good fruit
"If you lie to the computer, it will get you."
Favorite Granny's Wisdom Pearl
"If you lie to the computer, it will get you."
Favorite Granny's Wisdom Pearl
Junilu Lacar wrote:Not using a char[][] eliminated the need for me to do anything like this:
Eliminating this will probably save you a significant amount of time.
"If you lie to the computer, it will get you."
Favorite Granny's Wisdom Pearl
I wrote:This is what I submitted
Junilu Lacar wrote:This is what I submitted:
new TextEnlarger().solve();
private String zoomColumn(String line, int zoom) {
char[] buf = new char[line.length() * zoom];
int offset = 0;
for (char ch : line.toCharArray()) {
Arrays.fill(buf, offset, offset + zoom, ch);
offset += zoom;
}
return String.valueOf(buf);
}
}
"If you lie to the computer, it will get you."
Favorite Granny's Wisdom Pearl
"If you lie to the computer, it will get you."
Favorite Granny's Wisdom Pearl
max 15 (to solve)
What is happening here?
new TextEnlarger().solve()
Why the * before zoom? Is it a reference?
Why do we have an offset?
Why do we return the value of buf?
Why do we return the value of buf?
Paul Clapham wrote:Fixed that for you.
"If you lie to the computer, it will get you."
Favorite Granny's Wisdom Pearl
There is a little pitfall with Arrays#fill(); it uses exactly the same value to fill the entire array, so unless you fill with something like Double.NAN, all elements are the same, i.e. ∀ i, j • {i, j} ⊆ (0...myArray.length) → myArray[i] == myArray[j] where ... works on a first inclusive last exclusive basis.Junilu Lacar wrote:. . . Arrays.fill() does seem to be slightly faster . . . .
Junilu Lacar wrote:
max 15 (to solve)
Sure, if you get it right the first time. Very rarely do we programmers get the solution right the first time, do we? Or even the second, third, or fourth time.
For this problem, it took you at least a few hours to find your bug, didn't it? Even with a few people looking at your code, the bug still remained elusive. So, don't just count the time you were at your keyboard, typing away at the code. Count the time you spend thinking about the problem and coming up with a solution, and going out doing research to figure out why your solution isn't working for all cases, and debugging and testing, etc. Count ALL the time it takes you to get from not done to completely done.
"If you lie to the computer, it will get you."
Favorite Granny's Wisdom Pearl
"If you lie to the computer, it will get you."
Favorite Granny's Wisdom Pearl
Deja Quavern wrote:Just in that case : the bug was a trivial mistake that I discovered a few hours later (not after a few hours spent on staring at the code, I have lots of other things do at school).
Deja Quavern wrote:I will try to egoless my attitude
That is normal; fixing bugs is usually much easier than finding them.Liutauras Vilda wrote:. . . Problem been unsolved for 2 hours and 1 minute, even though to fix it took only 1 minute. . . .
"If you lie to the computer, it will get you."
Favorite Granny's Wisdom Pearl
Sounds a good idea. Maybe (only maybe) our Soft Skills forum might be an appropriate home for it.Deja Quavern wrote:. . . So any tips on relaxing the ego are welcome!
(shall I open a thread?)
So
Campbell Ritchie wrote: fixing bugs is usually much easier than finding them.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
fred rosenberger wrote:someone once told me there are two kinds of bugs:
1) Bugs that are hard to find, but easy to fix
2) bugs that are easy to find, but hard to fix.
Consider Paul's rocket mass heater. |