TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: What are your favorite code problems to give while interviewing?

10 pointsby yankoffalmost 10 years ago

5 comments

istvan__almost 10 years ago
This is a great topic.<p>I like to split my interview to the following steps:<p>- introduction, small talk about the company or the candidate - level 1 write a function that flips a bit that is represented as a single digit integer: (0 -&gt; 1, 1 -&gt; 0) flip two variables (int) without a third one: (a,b -&gt; b,a)<p>- level 2 what is the runtime complexity of a nested loop (assuming n == m) lease write a function that returns the list of numbers (in a string representation) that are permutation of N digits, where digits are 0..9. (1 -&gt; 0..9, 2 -&gt; 00 01....98 99 etc.) please explain recursion<p>- level 3 99% of the candidates do not make it to here I guess I should just make them flip that binary tree over the phone. :)<p>This is basics I think, so most of the software engineers should be able to solve these, even with a little hint.<p>On the top of these artificial tasks I usually ask them what is the biggest system they contributed code to, what was the contribution. What tools are they using. What is the favorite language and why. How do you to performance profiling for your code. What was the last problem that you solved in production, what was the problem and what is the solution.<p>And few others.
评论 #9710561 未加载
评论 #9709202 未加载
MalcolmDiggsalmost 10 years ago
I like to give some broken code and ask them to fix it...or give a Class that&#x27;s missing a function or two and ask them to fill in what seems to be missing.<p>I tend to like those types of problems more than the &quot;blank page&quot; kind...I&#x27;ve found it to be a closer approximation of the everyday tasks they&#x27;ll be encountering on the job.
评论 #9710391 未加载
hoarealmost 10 years ago
i guess if i say invert a binary tree i will be hunted down?:D
评论 #9708009 未加载
cweagansalmost 10 years ago
The kind that they can solve at a computer with a real code editor.
kwc98almost 10 years ago
I like to describe a problem that we are currently experiencing or one that we had in the past to see the troubleshooting logic in play. I love explaining something that is not quite optimal in production and see if this person could help.