Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Programming isnt everything


deathtaker26
 Share

Recommended Posts

Today, I learned a very valuable lesson towards my career. I went into a college programming competition. In this competition we were given 6 word problems and must solve them in am efficient manner. Your program has to work. Code is not judged. He who finishes the most working solutions by the end of the time period wins. If there's a tie, the time completed will settle it. Todays competition was my first, and though my programming was at a much higher level then the competitiors, I came in third, I lost to two more or less novice developers. My problem was in actually understanding the problem. Reading comprehension. I did not understand the problem and skipped to a much higher difficulty problem that took too much time to complete. This mistake threw the ability to finish the last problem in a reasonable set of time giving those who did the easiest problem first a higher advantage. Though I was literally a line away from finishing, I came in third due to a lack of understanding. Problem comprehension takes a bigger role in software engineering than you think.
Link to comment
Share on other sites

The easiest problem on here was the first. I understood this one though it did take me 2 to 3 minutes to manipulate the information given to find out what they were actually asking.

Note we got to choose our language, everyone chose C# as it's the easiest to convert input data between strings and integers and manipulate input string data into arrays.

The reason this question took so long to understand:

There is a lot of extra information being given here that is more or less irrelative to the problem being given.

Problem 1:

Your program is to use the brute-force approach in order to find "the answer to life, the universe, and everything". More precisely… rewrite small numbers from input to output. stop processing input after reading the number 42 all numbers are integers of one or two digits.

Example

Input:

1

2

88

42

99

Output:

1

2

88

**Explanation**

If it hadn't been for the examples given I wouldn't have actually understood what this was asking. Before reading the explanation, go ahead and see if you can come to an understanding what it's asking you on your own. Time yourself to see how long it takes you to understand

**Answer**

The actually code and answer to this problem was EXTREMELY basic. It can be done in about 20 lines of code tops. The question is asking that a user creates a console application that you enter numbers in. You enter a list of numbers and at the end of the problem print the same exact list of numbers. if the number 42 was in the problem. remove 42 and every number typed in after that. So if I type in the number 1, 2, 3, 42, 55, and 100 the output would return 1, 2, 3.
Link to comment
Share on other sites

The problem I made my mistake on in skipping

Reason it was hard:

Too much extra information irrelative to how basic it was. ( The input information is what really through me off and made me skip the question) The Input was asking some crazy equation that really didn't apply to what was going through my head.

It was generally the same as the first, could've been done with about 20 lines of code or less.

Pooja would like to withdraw x $US from an ATM. The cash machine will only accept the transaction if x is a multiple of 5, and pooja's account balance has enough cash to perform the withdrawal transaction (including banking charges).

Calculate Pooja's account balance after an attempted transaction

Input

Positive integer 0 < x <= 2000 - the amount of cash which pooja wishes to withdraw.

Nonnegative number 0 output

Output the account balance after the attempted transaction, given as a number with 2 digits of precision. If there is not enough money in the account to complete the transaction output the current bank account balance.

Example - successful transaction

Input:

30 120.00

Output

89.50

Example - incorrect withdrawal amount (not multiple of 5)

Input:

42 120.00

Output:

120.00

Example - Insufficient Funds

Input:

300 120.00

Output:

120.00

–---------------------------------

Explanation:

Once again, try to read and understand before reading the answer

Answer:

The question was pretty basic, it was asking that you input 2 numbers on the first line. The first number is the desired withdrawal amount. The second is balance in the account. After inputting the data, you had to check if the number was divisible by 5, if not return the account's balance. If it is divisible by 5, check if the account has sufficient funds for withdrawing. If the desired amount is greater than the balance in the account, return the account's balance. the last thing is, check that the number is greater than  or equal to 0 to make sure the account isn't adding. If everthing works out return the account's new balance (Original balance - Desired ammount).

Tip:

It occurred to me that I had a much better understanding of these questions as I typed them out on the community explaining everything. Perhaps trying to understand the question by writing it out first might help in the state competition wednesday.
Link to comment
Share on other sites

Finally, the last question.

Issue with the problem:

This problem is VERY dragged out and takes up too much time to develop. The reason I chose to do it is because the information is more up front and it gives you more variables that are easier to understand rather than dragging around more useless information. MOST of the information is relative but not all. Because it was easiest to comprehend, I chose to do it thinking it would be easier to code.

The Problem:

Nikhil has designed the following game. The game is played in a set of rooms in a dungeon arranged in an M x N rectangular grid. In one of the rooms the evil wazir has imprisoned the princess. The noble prince is on the way to rescue the princess.

The prince starts in the room at the top left corner of the grid, which is labelled (1,1). Each room contains some guards. It takes a certain amount of time before the prince can kill all the guards in teh room he is in. The time taken to kill the guards varies from room to room. Once he has killed all the guards in a room, he can move on to any one if its neighbors by going left, right, up or down, provided, of course, that there is a neighboring room in the corresponding direction.

The wazir, knowing the prince is on his way, has set a time bomb that will kill the princess after T seconds. You will be given the position of the princess, the time left for the bomb to go off and the time it takes for the prince to kill the guards in each of the rooms in the dungeon. Your task is to determine if it is possible for the prince to reach the princes and save her by defusing the bomb before T seconds expire.

For example, Suppose the dungeon is describe by the following grid of numbers.

```
2 3 2
2 5 1
5 3 1
3 1 1

```

The number at position (i, j) indicates the time taken for the prince to overpower the guards in room (i, j) suppose the princess is in the room at position (4, 2). if T = 10\. there is no way the prince can reach the princess in time. However, if T = 15 the prince can reach the princess with 4 seconds to spare, as follows. Starting from (1, 1) he moves right to (1,2) and then to (1,3), comes down all the way to 4, 3 and then moves to 4, 2) this takes 11 seconds. (note he must also overpower the guard in the room where the princess is incarcerated). you can check that he cannot reach the princess with more than 4 seconds to spare by any route.

Input:

The first line contains two integers, M and N indicating the number of rows and columns in the rectangular dungeon. Lines 2,3, … , M+1 contain N positive integers. The Jth integer on line i+1 is te time taken to over power the guards at room (i,j). The last line in the input, line M+2 contains 3 integers a, b and T, where (a,b) is the position of the cell where the princess is held and T is the amount of time before the bomb goes off.

Output

If it is not possible for the prince to save the princess then print a single line with the answer "NO" otherwise print two lines. The first line should say Yes. The seconde line should contain a single integer indicating the maximum possible time to spare when the pince rescues the princess.

Constraints:

You may assume that 1 <=N, M <= 70

```
4 3
2 3 2
2 5 1
5 3 1
3 1 1
4 2 15

```
Explanation.

This one is kinda complex but at the same time, more upfront than the rest. THe fact that it went so in detail gave more information so it was easier to understand what they were asking for. I ignored most of the information from the input and only took key factors out of the ouput but I still misunderstood what I was looking for…

Answer:

The goal is basically a path finding solution. The prince needs a path generated that gives the least ammount of time. It's like rendering a map on a game like eclipse uses.

Each room is in that output and that room's number is how long it takes to clear the map. You need to add up numbers and find the fastest route to get to the prince.

A a game developer I naturally understood some stuff here. It was easier changing values N and M to X and Y. The first line is going to contain how many rooms you will have on an X axis and the Y would be the rooms on the Y

the next few lines are the time for the rooms. line you enter is a row of rooms and their times. when you're done entering in the rooms, the last line of input needs to be the X of your princess, the Y of your princess, and the time it takes for the bomb to go off. Now the thing that takes soo long to do is writing the equation to find the quickest path to save the princess and an algorithm to calculating every path to see if it's atleast possible. If I had had more time my algorithm would've been simple

the character starts at 1, 1\. He can now go to either room 1,2 or room 2, 1 He is going to have to choose the room with the least amount of time that is in the direction of the princess. and that keeps repeating so on and so fourth.
Link to comment
Share on other sites

This is definitely a large problem. One of the biggest problems I had when starting at Ubi was understanding the tasks. Most of the time you are given one line Jira tasks with little or no information given. It is up to you to figure out what it means. 

The first example took me about 30 seconds to figure out what it meant. I did have to read it two or three times to figure it out. It is definitely drawn out. I think the only reason I got it so fast is that I have been practising this type of thing. My advice is go to www.hackerrank.com. They have a bunch of problems of all skill levels. They are mostly worded like your examples. Doing these challenges has really helped me read programming challenges that use unnecessary verbose or syntax like:

```

The first line of each test case contains two space-separated integers, N and K. 
The next line contains N space-separated integers, a1,a2,…,aN, representing the arrival time of each student.
```
and really just solve programming challenges in general. Its a great site, you can use just about any language you want. Its also used by a lot of tech companies to hire employees. Not to mention all the cash prizes etc.
Link to comment
Share on other sites

> that was the point. We had 1 hour to do them. Its not hard to code. Understanding the problem was the point if you read the post.

That's my point. Most of these are extremely simple. I mean, it shouldn't take more than a minute or two to read and fully understand the problem.
Link to comment
Share on other sites

> That's my point. Most of these are extremely simple. I mean, it shouldn't take more than a minute or two to read and fully understand the problem.

Well Gee wiz John, WHY DON'T YOU JUST SUCCEED AT EVERYTHING YOU DO?!

Lol, in all seriousness I have a serious reading comprehension issue. I'm not good at reading and understanding what I read. Or even remembering what I read.
Link to comment
Share on other sites

> Well Gee wiz John, WHY DON'T YOU JUST SUCCEED AT EVERYTHING YOU DO?!
>
> Lol, in all seriousness I have a serious reading comprehension issue. I'm not good at reading and understanding what I read. Or even remembering what I read.

Say that again. I mean, can you please rephrase that?
Link to comment
Share on other sites

> Say that again. I mean, can you please rephrase that?

I mean, I have a learning disability that I don't really understand details about. But when I read something, half the time I don't remember what I read. I can read an entire book and probably only remember 50% of what I read in it. Don't get me wrong, I love reading, In fact I'm a very fluent and fast reader. But when it comes to the comprehension, I usually don't take in what I read. In some cases I have to read a book two or sometimes 3 times to actually know the story.

Anyways, for the comp on saturday, I have a friend of mine who has perfect reading comp scores on his placement exams helping me study. I'm hoping if maybe I get a week of studies in I'll preform better.
Link to comment
Share on other sites

> I mean, I have a learning disability that I don't really understand details about. But when I read something, half the time I don't remember what I read. I can read an entire book and probably only remember 50% of what I read in it. Don't get me wrong, I love reading, In fact I'm a very fluent and fast reader. But when it comes to the comprehension, I usually don't take in what I read. In some cases I have to read a book two or sometimes 3 times to actually know the story.
>
> Anyways, for the comp on saturday, I have a friend of mine who has perfect reading comp scores on his placement exams helping me study. I'm hoping if maybe I get a week of studies in I'll preform better

Sorry, I don't quite understand what you're trying to say.
Link to comment
Share on other sites

```

class Program
{
static void Main(string[] args)
{
List numbers = new List();
Console.WriteLine("Input Numbers:");
bool reading = true;
while(reading)
{
var n = Console.ReadLine();
if (int.Parse(n) == 42)
reading = !reading;
else
numbers.Add(n);
}

Console.WriteLine("Output:");
foreach (string n in numbers)
Console.WriteLine(n);
}
}

```
First problem solved in approximately 3 minutes.  Far less than 20 lines.

As for the point of this topic.  Programming, in every sense of what it entails, is simply problem solving; you write algorithms that solve problems and that produce a desirable result.
Link to comment
Share on other sites

> ```
>
> class Program
> {
> static void Main(string[] args)
> {
> List numbers = new List();
> Console.WriteLine("Input Numbers:");
> bool reading = true;
> while(reading)
> {
> var n = Console.ReadLine();
> if (int.Parse(n) == 42)
> reading = !reading;
> else
> numbers.Add(n);
> }
>
> Console.WriteLine("Output:");
> foreach (string n in numbers)
> Console.WriteLine(n);
> }
> }

> ```
> First problem solved in approximately 3 minutes.  Far less than 20 lines.
>
>  
>
> As for the point of this topic.  Programming, in every sense of what it entails, is simply problem solving; you write algorithms that solve problems and that produce a desirable result.

As stated, the problems is fairly easy to actually solve. I had no problem doing it. My problems were understanding what I was supposed to do.
Link to comment
Share on other sites

> As stated, the problems is fairly easy to actually solve. I had no problem doing it. My problems were understanding what I was supposed to do.

Which is cool and you already understand that programming is problem solving on two fronts; comprehending the problem (which you've stated you have issues with) and producing an algorithm that solves the problem.

Evan made a good suggestion. Practice reading comprehension and work on your ability to retain information.  We played "KIMS" games when I was active duty.  You'd basically be put under extreme duress (physically and mentally), be told to memorize shape, size, color, what the object was, and if it was serviceable or non-serviceable, and you'd write down as much as you could remember as soon as 5 minutes from memorization to a full 24-48 hours later (10-20 objects at a time).

You do a few dozen tests like that and you're bound to improve.  The job that I have requires me to remember things as far back as 2 weeks, I work with numbers all day every day, and sometimes I have to repeat them often for multiple purposes.  When I first started I had a really hard time focusing; it was definitely information overload.  Seven months later I can memorize multiple 5 digit numbers, remember their purpose, and recall them as needed with little thought as well as recall even minute details regarding packaged materials, where they went, even right down to where they were put on a truck.  It's so ridiculous that I find myself completely amazed at it.

tl;dr.  Train your brain. :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...