What if I know the answer to something interviewer has asked me? [closed] - coding-style

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 days ago.
Improve this question
I am appearing for an Amazon interview next week. Now what if I already know the answer to certain coding question the interviewer has asked me. Should I say the answer on the spot or should I pretend that I'm thinking over it and give the answer only after certain time?

In college we studied questions asked by interviewers, and I knew a lot of the ones I was later asked when I interviewed myself.
First off: Don't lie. This should be obvious.
Let the interviewer know you've seen something similar, talk through what you heard them ask and compare it to what you remember from before. They might stop you, or they may point out a variation in the question that you missed when you "thought you knew the answer." As an interviewer, I've done this on purpose. I've asked a variant on a previous question from their on-campus interviews, and I've had some folks keep trying to solve the wrong question - even when I pointed out that's not what I asked.
The interviewer might add new constraints to the problem and have you solve those. My questions are open ended such that if a candidate either gets stuck or breezes through, I have ways of adjusting to keep making progress. It's bad for everyone if the candidate gets stuck and produces nothing, or doesn't feel challenged and doesn't get a chance to show how they think on their feet.
Best of all, show the interviewer something new about a problem they might not have seen before. In my interviews when I was hired, we started with a question I knew... Then I showed a variant I came up with. Then we talked about something I was learning, and we did a design brainstorm on the board. (at the time I was learning C++ on my own, and we talked about how class interfaces and inheritance might be implemented starting from C.)
To reiterate: Don't lie. If you get caught, it's over.
And to the rest of us: Make up your own questions - I hate being asked a programming question out of a book. It's disrespectful and unrealistic. Come up with a question inspired by what you plan to have the candidate do.

Related

How to prepare for Olympiad in Informatics [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am a high school student who live out side of the USA.
So... please excuse any mistake.
I am planning to study for Olympiad in Informatics(I have never participated in this contest) and I am going to try on next year since it begin in April in our country I think I still have a time to prepare for it. And actually, I am kind of interested in data structure and algorithms . Although I cant get a good result from the contest, it would be worth experience to me.
However, there are no one who have ever participated in this contest in our school. So, I have no idea how to prepare.
I sure know how to code with python ,C ,C++ (but I am not good at it..)
So... If you guys know about it, please just give me some information. like books and way to prepare.
First research what the contest is about.
Learn your stuff. If it's algorithms, then I suggest something like Skiena, The Algorithm Design Manual. I think there's also a competitive programming book by Skiena.
Then practice. It looks like it might be similar to "classical" programming contest, so it would make sense to try:
- https://uva.onlinejudge.org/
- http://www.spoj.com/
- Any of the numerous online judge systems.

How do people solve programming competitions so fast? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I hope this is not a vague/broad/subjective question. If it is, please close it.
Anyway, at several programming competitions (like Google's Code Jam, Facebook's Hacker Cup and so on), by the time I've successfully understood a problem and have an inkling of how to approach it, I see that half the questions are already solved by many people.
My question is, how do these people get so good? Is it pure genius? Is it experience? Is it the ability to think really fast? How would you suggest I improve my skills? I would say I'm a competent programmer. I can eventually solve some of those questions.
Additionally, whenever I inspect the code of winners, I see a LOT of macros being used. This implies to me that they sort of have a template (like #define for loops to some abbreviated version) which they use to program faster. Does this make a significant difference?
The thing is, you're competing against people who've spent massive amounts of time mastering their skill to compete in these competitions. You're unlikely to catch up any time soon, but...
How do these people get so good?
Have the theoretical knowledge to solve the problems and practice, practice, practice.
Is it pure genius?
It can be, but practice can to a reasonable extent make up for it.
Is it experience?
Yes.
Is it the ability to think really fast?
Not really. Practice allows you to approach the problem correctly and skip insignificant details in the problem statement.
How would you suggest I improve my skills?
Get the theoretical knowledge and practice.
Do macros make a significant difference?
It may cut 10% off of your time, but probably not much more.
Statistically speaking, any programming competition with a large enough audience will attract super-talents who can churn out nice and elegant code at super-speed. It's like running the marathon. Running it in 4 hours is really good, even if the world record is around 2 hours. Don't worry about it.
Focus on code quality and elegance instead, instead of being able to churn out code at super-speed. Practise, have fun, and don't look too much at how fast other people are working.

automated theorem proving program - where to start? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm a second year student with my discrete mathematics 2 assignment is to make an automated theorem prover. I have to make a simple prover program that works on Propositional Logic in 4 weeks (assuming that the proof always exist). I've googled so far but the materials there is really hard to understand in 4 weeks. Can anyone recommend me some book/site/open source code that is for beginners or some useful hints to start with? Thank you in advance.
Note: I flagged this to be moved to the Computer Science site because they are much more on top of ATP over there.
It would be nice if you could include what you have looked at and why it does not help you. Then we can figure out what might be better for you. Also, if you have to write a program, then knowing what languages you know will help. Most of what I do with this is done in a functional language such as OCaml or F#, or a logic language such as Prolog or Mercury.
Have you seen "Handbook of Practical Logic and Automated Reasoning" (WorldCat) by John Harrison. I included the (WorldCat) link so you can find the book in a local library as opposed to waiting to buy it which will eat up most of your time.
If you look you will find the OCaml code at the bottom of the page, and F# here and Haskell here.
In case you haven't see the ATP or Proof Assistant at Wikipedia, you might get a lead to some code and papers.

How can I come up with creating an algorithm which simulates a real time situation [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm good at algorithms but not as good as converting real-time problems and learning them throughly to make it as an algorithm. I would like to know if there is any book/paper that teaches or makes you demystify the situation and formulate it as an algorithm. (Its much like training your mental ability to break the situation and comeup with algorithm in a crisp.)
Showing some of the ways to approach these kinda problems. and any easy learning links/material would help me a lot.
Note: I know SO doesnt allow to ask for the opinion or something vague (I dont mind my Q being downgraded). But I am asking some concrete problem and hope can get some nice info from some of the great minds here.
The word that fits better as a direct answer is "experience". There exists no magical formula to convert a real time problem into some algorithms that solve it. As an analogy, there exist no predefined patterns on how to solve a mathematical problem. It is a mind's task to express the solution, based on some fundamental knowledge and on experience that is accumulated though constant learning.

What statups are expecting while asking to solve a programming challenge before hand? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have applied to couple of startups and most of them are asking to solve programming challenge before they start on the interviewing candidate.
I have submitted couple of the solution and all the time getting rejected in the initial screening.
Now what i think is, they will see my coding style, algorithm and OOD concepts that i have used to solve the problem. Can you guys input more on it as what other details are taken into consideration and how can i improve my coding for getting selected.
By the way, i did all my coding in either Java/Perl.
Nice question, I am a new grad too... One thing I notice: When you do the exercise home, they expect you to use the best algorithm out there. In my opinion code modularity, even on a small function is key. Put lot effort into the code because they are not just judging you, but comparing you against other candidate. The one which seems to have put the more effort wins.
ps: Ask this question on programmers.stackexchange, you will obtain some good inputs there.

Resources