Hello from Germany

Back to Introduce Yourself forum

TimeToMoveOn     2020-07-18 13:45:31

Hello, everyone, so first of all I would like to thank the admin of this site for many wonderful moments of the last months, some of them even years! My name is Simon, I am 19 years old and come from a small town in Germany. Everything I know about programming, I taught myself in the past time. This summer I graduated from school and will study Business Informatics at the end of the year. In my spare time I do a lot of sports and like to program, even though I don't know much about programming and certainly create the opposite of clean code, it is fun to try to solve problems.

While I'm at it anyway, dear admin, I have a suggestion for another problem if you like, the contact page says I can reach you through the forum, in which section should I create the thread? :)

Many greetings! Simon

Rodion (admin)     2020-07-18 16:15:27
User avatar

Simon, Hi! Thanks for your story! It's always great to know better people who come here :)

I have a suggestion for another problem... in which section should I create the thread?

Anywhere you like! Even just in response to this same thread, it would be ok. I really thought of removing "sections" from forum as it only confuses people, but still failed to do this...

This summer I graduated from school and will study Business Informatics at the end of the year

It is curious to know, if you don't object, whether you graduated studying in the school online this spring due to virus matters, or normal classes were kept?

And do you enroll College or University? I'm a bit puzzled of which institutions teach programming nowadays in other countries.

come from a small town in Germany

also, do you mean you needed to move to some larger city to continue your education?

TimeToMoveOn     2020-07-18 17:18:28

That's right, from time to time I also like to read up on who is on this site! :)

All right, the task idea will follow at the end of this post! :)

*It is curious to know, if you don't object, whether you graduated studying in the school online this spring due to virus matters, or normal classes were kept?

The virus has been disrupting school operations in Germany since mid-March. My final exams were in May and June, I had to write them at school. The time in between - there were special offers for us as "final students" for lessons. Partly we had to go to school, partly there were online lessons. But most of it was only to repeat the contents we had learned before. The virus confused my whole graduation in many things, but there were not many new things we had to learn anymore.

And do you enroll College or University? It's a bit difficult to answer, because I have no idea how the educational systems in other countries are structured. Here it is so that after 10 years we can get a degree, with which you can start an apprenticeship, for example, but not study. After 12 or 13 years (depending on the school you choose) you can get a degree that allows you to study, which is where I am at right now. I have chosen a university of applied sciences, the only difference to a normal university is that universities of applied sciences are a bit more practical oriented. I am not sure if you can compare it to a college. The degree you get at both types of college is the same.

So, do you mean you needed to move to some larger city to continue your education? My city has about 50,000 inhabitants, that's big enough when it comes to grocery stores and other things, and the city is very beautiful! But yes, my studies are only available in slightly bigger cities, in about a month I will move away from home for the first time and live alone. On the one hand this can be very nice, on the other hand in a new, big city many unknown things come up to me :) I will also work in a software development company from september, but not as a developer but as a buisiness analyst! :)

I hope that I answered all your questions halfway good! If something is still unclear just ask again! :)

So finally I try to explain the Problem Statement :)

Before I start I want to make it clear that I did not make this up myself! I was confronted with this problem during a coding interview two years ago and I thought it fits perfectly into the principle of this site. Basically the solution is quite simple, but the first time I needed a little time to get it! :)

Imagine that you have several columns of different sizes next to each other. All the columns are standing in a container or something similar. The picture here should illustrate it a little bit (in case you should take the problem with you and need a good picture I would of course make a proper one)but for the understanding it is enough for now. The column height could simply be given as an integer array, for example (2 3 1 5 4 0 2 3 6 3 4) Column example

Now we pour water over the columns, in the spaces between some of them the water stops, but if it has no clue, it just flows away. It just follows the physical laws of nature ;) The task now would be to calculate how much water remains on the columns, i.e. how much water can be "stored". For illustration this picture shall serve: Column example with water

So the solution for the array given above would be 14. Of course you could write a nice story about it or something similar, but the basic idea is hopefully clear :)

In this sense, best regards!

Rodion (admin)     2020-07-19 20:28:47
User avatar

Dear Simon! Please don't think I missed your post!

On contrary, I get your problem idea at once and I feel it is really curious. Though you say it is quite simple, I see there is a good opportunity to scratch one's head to find algorithm and to work on correct implementation.

I'll try my best to create correct data generator and checker and to add this to our collection.

Also I have a horrible thought - this problem allows extension to 2-dimensional plane... And, well, to higher dimensions... :o

qwerty     2020-07-20 10:07:05

this problem allows extension to 2-dimensonal plane

For me, this problem is already 2-dimensinal (at least pictures are 2D).

And... I thought it should be simple, but failed to implement it correctly. My program outputs much more water than should :).

qwerty     2020-07-20 10:30:32

Or it is not an implementation problem... maybe my algorithm is just wrong.

TimeToMoveOn     2020-07-20 10:32:52

hey Rodion, all good, you still answer within a day which is pretty fast

so first of all thank you for considering bringing it into the collection, i never thought about making it a higher dimensional problem, but the thought is interesting

i agree with qwerty_one *For me, this problem is already 2-dimensinal (at least pictures are 2D).*

but it would be super easy to make a three-dimensional problem out of it, then the columns would not only be next to each other, but also behind each other :D Sounds like a cool extended version ;)

I didn't find the implementation so difficult anymore after I understood the principle, but I know it already a little bit longer, so stay tuned and you'll have it soon qwerty_one! ;)

Rodion (admin)     2020-07-20 20:42:10
User avatar

Friends, under 2D plane I meant the plane unto which rain falls (from the 3rd dimension) though you most sure get my idea. Anyway I have no clear idea how to solve it well right now :)

Now, I think, I have drafted data generator and calculation for answer, please help me with check so that I won't post broken task as happened :)

For arrays like these:

7 2 4 6 7 4 16 9 8 8 29 22 11 28 25 18 26 28 9 24 17 17 13 4 4 2 5

4 11 1 7 4 8 7 26 20 19 3 4 3 26 11 18 30 17 27 11 13 13 14 9 8 3

6 1 14 10 17 17 13 10 25 2 27 27 3 1 23 1 13 22 9 18 4 18 1 11 4 7

4 7 14 4 20 9 10 3 6 17 19 10 25 2 2 14 26 5 2 3 7 11 11 1

answers should be 93, 147, 151, 160 respectively - is this correct?

qwerty     2020-07-21 00:13:36

Rodion, I checked your results manually, and it seems they are correct:

7 2+5=7 4+3=7 6+1=7 7 4+3=7 16 9+7=16 8+8=16 8+8=16 29 22+6=28 11+17=28 28 25+3=28 18+10=28 26+2=28 28 9+15=24 24 17 17 13 4+1=5 4+1=5 2+3=5 5
5 + 3 + 1 + 3 + 7 + 8 + 8 + 6 + 17 + 3 + 10 + 2 + 15 + 1 + 1 + 3 = 93

4 11 1+10=11 7+4=11 4+7=11 8+3=11 7+4=11 26 20+6=26 19+7=26 3+23=26 4+22=26 3+23=26 26 11+15=26 18+8=26 30 17+10=27 27 11+3=14 13+1=14 13+1=14 14 9 8 3
10 + 4 + 7 + 3 + 4 + 6 + 7 + 23 + 22 + 23 + 15 + 8 + 10 + 3 + 1 + 1 = 147

6 1+5=6 14 10+4=14 17 17 13+4=17 10+7=17 25 2+23=25 27 27 3+20=23 1+22=23 23 1+21=22 13+9=22 22 9+9=18 18 4+14=18 18 1+10=11 11 4+3=7 7
5 + 4 + 4 + 7 + 23 + 20 + 22 + 21 + 9 + 9 + 14 + 10 + 3 = 151

4 7 14 4+10=14 20 9+11=20 10+10=20 3+17=20 6+14=20 17+3=20 19+1=20 10+10=20 25 2+23=25 2+23=25 14+11=25 26 5+6=11 2+9=11 3+8=11 7+4=11 11 11 1
10 + 11 + 10 + 17 + 14 + 3 + 1 + 10 + 23 + 23 + 11 + 6 + 9 + 8 + 4 = 160
qwerty     2020-07-21 00:36:42

Still have trouble getting it right programmatically though.

For example, input data:

0 1 0

Output should be 0, but my program output is 1.

I wonder what your checker returns for that example?

qwerty     2020-07-21 00:59:52

0 0 0, 0 0 1, 0 1 0, 0 1 1, 1 0 0, 1 1 0, 1 1 1 - answer should be 0, I think.

1 0 1 - answer is 1.

Rodion (admin)     2020-07-21 06:01:39
User avatar

Oh, thanks a lot, though didn't mean to waste your time with manual check of lengthy examples! It looks you were doing calculations quite past midnight!

For 0 1 0 my code yields 0, yes. I wonder what approach you have implemented, though probably we'll be able to discuss it bit later, perhaps in the topic, private for this task, when it is created. Hopefully I'll add it in a few hours, thanks to your help :)

Quandray     2020-07-21 06:21:40
User avatar

On https://practice.geeksforgeeks.org/problems/amount-of-water/0 using the Expected Outcome button with input
4
27
7 2 4 6 7 4 16 9 8 8 29 22 11 28 25 18 26 28 9 24 17 17 13 4 4 2 5
26
4 11 1 7 4 8 7 26 20 19 3 4 3 26 11 18 30 17 27 11 13 13 14 9 8 3
26
6 1 14 10 17 17 13 10 25 2 27 27 3 1 23 1 13 22 9 18 4 18 1 11 4 7
24
4 7 14 4 20 9 10 3 6 17 19 10 25 2 2 14 26 5 2 3 7 11 11 1
gives the same output as you

Rodion (admin)     2020-07-21 06:32:07
User avatar

Hi Grae and thanks for your hint! Well, probably we don't want to have the task which is represented in exact form at other resource. Let me think a bit whether we can make something interesting out of 2D version...

qwerty     2020-07-21 09:22:42

Maybe we can add some parameters, so it will be harder to find solutions online.

For example, add width of column and distance between colums as parameters.

So all calculations above are valid only for width = 1 and distance = 0.

qwerty     2020-07-21 09:27:26

Of course, I'm not sure if this idea is new. Hard to propose completely new idea nowadays. But at least I'm trying.

qwerty     2020-07-21 09:36:30

Example made by manual calculation:

If we have width = 5, distance = 3, heights = 3 2 4 1...

...we get the following answer: 26.

TimeToMoveOn     2020-07-21 09:58:52

Hey everyone, that the puzzle exists so on another page I'm sorry, as I wrote above it's not from myself, but from a coding interview. You could simply add a dimension to the columns, so not only go left and right, but also front and back. to make it even more difficult you could give the columns a width, so not all of them are 1x1 (unit of measurement) wide, but a x b As a result, the water that remains on the columns should be expressed in cubic centimetres

a very simple example would be input:

3 -> number of rows

3 -> number of columns per row

1 -> width of the columns

1 -> depth of the columns

5 5 5 -> first row 5 1 5 -> second row 5 5 5 -> third row

Answer:

4 cc³

Rodion (admin)     2020-07-21 21:06:46
User avatar

No worry, of course as there are lots of similar web-sites, simple problems usually may be found in more than one of them. And thanks to you and qwerty_one for suggesting advanced variant. Be sure, we'll find the place for it too :)

However I spent this day trying to solve 2D version and now I think it is ready.

New problem: Rain Must Fall!

Not sure my own solution is correct... So let's wait for someone to try it... :)


Now I forgot to thank you for your detailed story about education in Germany and your situation - you see, I'm giving classes in some local school and my students (they are 14-18 y.o.) often discuss where to enroll etc. So it is very good to be able to tell them how things are organized in other countries. Here school takes them at age of 7 and graduates at 17-18. Many people here are obsessed with university education which leads to having a lot of universities but very poor average quality of such education. And we have weird last quarter, completely online this year - somewhat difficult to bear. Especially as my classes are practical by nature.

And this was really charming:

I will also work in a software development company from september, but not as a developer but as a buisiness analyst

I honestly get used to think that people become BA after spending few years as QAs for example. But most probably there could be quite varying degrees of business requirements to analyse and with proper organization every bright head even without tons of experience is valuable! My best wishes - and hope you'll tell more about this in the fall of the year. Well, won't it make study difficult?

qwerty     2020-07-21 23:58:25

Oh, thanks you much for the new problem! Not sure if I can solve it, but I definitely will try.

TimeToMoveOn     2020-07-22 00:43:38

Wow... that was definitely an exciting evening. After I somehow managed to solve the problem "Game 2048" a few hours ago, I found this post on the forum. Actually I wanted to go to sleep after the last problem, but then I was so happy about the new one that I took a closer look at it. Now, about three hours later, I arrived at 3D models for illustration Where I ended^^ and I'm almost sure that it can't get any more complicated! I have collected many approaches tonight and will then slowly despair of the implementation starting tomorrow. But it will surely be fun ;)

Once a very warm thank you for the fast implementation for us! :) The "story" I liked to tell ;) it's always good to know who's running around on the site.

I'm giving classes in some local school

I can imagine that you are a great teacher and can teach the students huge amounts of knowledge. That the virus makes teaching so difficult is certainly a problem worldwide at the moment. But we will (hopefully) get over it and one day we will continue our life as usual.

I honestly get used to think that people become BA after spending few years as QAs for example.

I got this job through an internship. At that time I was a little younger and wanted to become a developer. So I did an internship as a developer in this software company and found out that there are a lot of people who are much better at programming. Better than I could ever be. Normally that would give me motivation to become as good, but in this case I had a lot of conversations about becoming a developer and interesting alternatives. In the end, the boss on site made me an offer to work there as a BA during my studies. We will find out what exactly comes up, if I will be able to do everything and if I am suitable for it at all.

Well, won't it make study difficult?

It will definitely be stressful, but I had a few months rest after school and I am looking forward to new challenges!

But now a good night and hopefully tomorrow I will be a little closer to solving the problem!

Rodion (admin)     2020-07-22 07:14:40
User avatar

To Simon:

I can imagine that you are a great teacher

Ha-ha, you are too kind, but no - I don't have higher education as a teachear - and this school has really cool staff - but my niche is electronics classes once per week and some similar but more "applied" activities.

I arrived at 3D models for illustration

This game me idea we should add some picture to the problem statement. I remember Matlab offered many ways of representing 3D surfaces, so I'll go and investigate...

So I did an internship as a developer in this software company and found out that there are a lot of people who are much better at programming. Better than I could ever be.

Hm-m-m... I think you underestimate how people progress through years and underestimate yourself :) But I'm a bit curious in which field this company works, if not a secret.

To qwerty_one

Not sure if I can solve it, but I definitely will try.

Interesting question. I'm sure you can since I vaguely understand there could be several solutions and they are based on approaches which you definitely used in other problems. :)

However I hope it will puzzle anyone a bit first as it puzzled me (heh, provided my solution is correct, again)...

Alexandr Milovantsev     2020-07-22 13:18:52

Sorry that I jump in into in your conversation, but I have tried to solve this new problem and got answer different from expected by the checker. Because problem is in debug state, please check my solution. I also temporarily published solution folder at (link removed after bug found, thanks, RG) , if it can help. My solution is pretty straightforward and I can not imagine what can go wrong with it.

Rodion (admin)     2020-07-22 13:23:14
User avatar

Alexandr, you are welcome and thanks for help with testing. I'll try to look at it and hopefully come back soon!

UPD thanks once more, stupid bug in my code - wrong stop condition so in some cases it haven't poured all water out :( Sorry, I'll update checker in a dozen of minutes.

UPD2 now the checker is updated (hopefully without mistakes this time).

TimeToMoveOn     2020-07-22 14:14:53

It took me a few tries and again minimally adjusted my solution, but now I got a "correct" three times in a row and I hope that the solution fits! :)

That was ten hours of fun and despair all at once ;) Thanks a lot!

Rodion (admin)     2020-07-22 14:20:14
User avatar

Yeah, this coincides with time when I updated the checker with small fix after studying Alexandr's sample outputs.

Please excuse me for inconvenience - most silly is that was not bad algorithm, just silly logical error in it. Probably I should avoid submitting code that late in the night :)

qwerty     2020-07-23 12:42:43

I vaguely understand there could be several solutions

That's true. I looked into solutions of TimeToMoveOn and Alexander Milovantsev and they differ so much from mine. Their solutions do not even used floating-point arithmetic.

A very good problem, hard to solve (at least for me), but interesting.

TimeToMoveOn     2021-03-26 12:35:51

10 months go by so quickly, so here's a little update. The first semester with exams is over and I'm relatively satisfied. For the first time in a long while, I can devote myself to a few puzzles on the site. I'm slowly reaching my limits, but I'd definitely like to get 15 for the certificate.

The work as a BA is interesting and I learn more every day that I work than in a week at university. On the side, I get to work on a React project and am currently learning Javascript and Typescript. It's all very stressful and Corona doesn't make the situation any easier, but nothing beats solving a few puzzles here ;)
I hope you are all well, greetings!

Rodion (admin)     2021-03-26 18:07:47
User avatar

Simon, Guten Tag! Glad to hear from you!

The work as a BA is interesting and I learn more every day that I work than in a week at university

Well, I often felt the same. Though there is some heap of useful "fundamental" knowledge in the Universities, but these are usually of not immediate value. And part of things they teach are complete trash (percentage depends on university of course).

Thus as Jesus said, "this should be done and that not left undone" - e.g. I believe your combining of two ways of learning - academic and practical - will allow you reaching real heights :)

definitely like to get 15 for the certificate

Ha-ha, you are quite welcome, of course! Check the later few, by the way, in Scheme language. They may be easier than others, but further in table due to few solvers. On the other hand scheme somewhat drives people to practice functional approach (popular in typescript and javascript you mentioned, but you probably already seen this enough).

I hope you are all well, greetings!

Yep, all seems less or more fine. Job is going to continue in remote mode, but school where I'm teaching part-time at last returns to normality. Decided to try our "infamous" vaccine in January - well, it failed to kill me - so now guessing whether it makes any protection at all... People have some hopes with spring coming. Hopefully things will turn right again by and by :)

TimeToMoveOn     2021-07-24 13:47:11

Hey Rodion, It's been a long time since I showed my face here, about half a year. I can agree with you on your points above, a mix of work and university is priceless. I also hope that somehow everyday life will gradually return to your school and that a more normal life will be possible.

I got to work with a small team from my company over six months building a web app in React + Typescript. So for the first time I was able to realize a real, now productive project and expanded my skills many times over. Working on it was so incredibly fun besides the usual BA job - it was incredible. Also some of the things I learned here on this site have helped me in this project - all in all a great thing.

Now I'm in my second exam phase at the university and find time to look at a few problems here again for a long time. The certificate is still the big goal at the end of a meanwhile years-long journey ;) Five are still missing - however, almost all open far beyond my abilities.

Anyway, I've seen that you haven't been on the forum for a while (at least it looks like that to me), so I hope you're well and healthy! Maybe you will find some more time soon and you can relax a bit here :)

Take it well, best regards!

qwerty     2021-07-24 23:16:17

Hello, TimeToMoveOn!

I haven't been in this topic for a while, but I still remember you and our combined efforts to make an interesting problem. I wish you all the best!

Noticed long absence of adminisrator too, but hopefully he will return soon... Meanwhile you may want to try Language Study - a problem which Rodion implemented in his latest visit. And not only that - he made whole series of Scheme-related problems and two tasks on neural networks before working on Language Study.

Please login and solve 5 problems to be able to post at forum