Piet Souris

Saloon Keeper
+ Follow
since Mar 08, 2009
Merit badge: grant badges
Forum Moderator
Piet Souris currently moderates these forums:
Netherlands
Cows and Likes
Cows
Total received
207
In last 30 days
1
Total given
148
Likes
Total received
1142
Received in last 30 days
15
Total given
173
Given in last 30 days
6
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Piet Souris

Solved day 5.

Again easy, but a bit tricky, it was easy to make some mistakes, like forgetting to skip some elements and to re-initialize the stacks between the first and the second part. But it was again fun.

I did the input manually, by far the fastest way, I think. So my input-routine for the test looked like:
It sure is tricky. When determining the files in the methods themselves, I used for each of the methods

but for your method, I also sorted the list with .sorted(), but it differed also between

and
1 day ago
Just read the exercise. Indeed the problem is the inputfile. Three strategies come to mind: using a regex to determine the position of each letter, the positions of the letters are fixed, so require just some counting, and typing the piles into your code, which is probably the quickest way. Won't have time until this afternoon, though.

Junilu Lacar wrote:@Piet I was looking at your Day 1 solution on GitHub.

Regarding this:

Do you need .boxed() on line 49? Doesn't mapToInt() already give you an IntStream?


An IntStream only has the sorted-method, without a Comparator. But now I wonder if when using just 'map' instead of 'mapToInt' will give me a List<Integer> straightaway. Gonna give it a try!

Just tried it:

works fine, even though getSumOfCalories() returns an int. Wonderful, that autoboxing!

Junilu Lacar wrote:@Piet: was looking at your Day 1 solution -- just want to point out that singular of Elves is just Elf.


Thanks! Just like in Dutch then: elf - elven
Be careful with what you wish... one day you might get it (and that'll be sooner rather than later)
hi Carey,

yes, I could have expected a performance test!

One remark though: in your Carey-test you create a list ar, that gets sorted. That means that from try 2, the argument-array is already sorted, and that saves a lot of time. I adjusted the test in two ways: one where each list is created in the method itself, and two where I create a general list, and in your method I take a copy and sort that. That gives quite a difference.

But the way to the outcome is much more interesting than the corresponding performance. and OP has quite a few solutions now. Hope he likes it.
2 days ago
Indeed easy again. But we haven't seen the last of it yet.... that hint to "longer numbers ...456...." probably means misery awaiting.

I used a record called Range, and I wanted to give it a constructor with a String parameter of the form "3-6". but I could not get that to work, some error about something being not canonical or likewise. So I added a static method Range of(String s), and that worked.

Java, of course.

edit: github
Indeed, nice and very readable. Here are two other ways that are O(n):
2 days ago
Day 3 solved. Sofar things have been easy.
You do not need that double for-loop. In matchCheck, the list is sorted, so you can simply do:
4 days ago
I have a few problems.

First of all, one would expect a move()-method to have an argument. So, what is the use of having a move()-method and writing a test for it? Or is it that the test will show that move() is not what we should have?

Second: using a String as a board seems very unlikely; it would be a very clumsy thing.

Therefore: are we not wasting our time with these two tests? Even for the sake of fake?
4 days ago
But don't you risk a StackOverflowException, with all these ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( et cetera)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))?
The problem with one of your tests was that you expected an Exception for the testcase:

But because the equals-method was not overridden:

p is NOT equal to q!
and therefore no exception is thrown.
4 days ago
Add this to your Point-class:
4 days ago